From 865825daf216e0b762211af390e4f1f06a50d986 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Apr 2022 09:16:00 +0000 Subject: [PATCH 001/145] Auto-generated commit 3b44cfb57384c996df7af6640e9b3d5f9aedfcec --- CONTRIBUTORS | 28 + LICENSE | 481 +++++++++ NOTICE | 1 + README.md | 1569 +++++++++++++++++++++++++++++ bundle.js | 3 + bundle.js.map | 1 + package.json | 37 + stats.html | 2689 +++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 4809 insertions(+) create mode 100644 CONTRIBUTORS create mode 100644 LICENSE create mode 100644 NOTICE create mode 100644 README.md create mode 100644 bundle.js create mode 100644 bundle.js.map create mode 100644 package.json create mode 100644 stats.html diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 0000000..e5c896d --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,28 @@ +# This file is generated by tools/scripts/update_contributors. +# +# Contributors listed in alphabetical order. + +Ali Salesi +Athan Reines +Brendan Graetz +Bruno Fenzl +Christopher Dambamuromo +Dominik Moritz +Frank Kovacs +James +Jithin KS +Joey Reed +Joris Labie +Justin Dennison +Marcus +Matt Cochrane +Milan Raj +Momtchil Momtchev +Ognjen Jevremović +Philipp Burckhardt +Ricky Reusser +Ryan Seal +Seyyed Parsa Neshaei +Shraddheya Shendre +dorrin-sot <59933477+dorrin-sot@users.noreply.github.com> +rei2hu diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fcc9934 --- /dev/null +++ b/LICENSE @@ -0,0 +1,481 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + + +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by this +license (the "Software") to use, reproduce, display, distribute, execute, and +transmit the Software, and to prepare derivative works of the Software, and to +permit third-parties to whom the Software is furnished to do so, all subject to +the following: + +The copyright notices in the Software and this entire statement, including the +above license grant, this restriction and the following disclaimer, must be +included in all copies of the Software, in whole or in part, and all derivative +works of the Software, unless such copies or derivative works are solely in the +form of machine-executable object code generated by a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES +OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + +DEPENDENCIES + +The library links against the following external libraries, which have their own +licenses: + +* OpenBLAS + +Copyright (c) 2011-2014, The OpenBLAS Project +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. Neither the name of the OpenBLAS project nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +* Electron + +Copyright (c) 2013-2017 GitHub Inc. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +* Boost + +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + + +* Cephes + +Copyright (c) 1984-2000 Stephen L. Moshier + +Some software in this archive may be from the book _Methods and Programs for +Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) +or from the Cephes Mathematical Library, a commercial product. In either event, +it is copyrighted by the author. What you see here may be used freely but it +comes with no support or guarantee. + +Stephen L. Moshier +moshier@na-net.ornl.gov + + + +ATTRIBUTION + +The library contains implementations from the following external libraries, +which have their own licenses: + +* FreeBSD + +Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. + + +* FDLIBM + +Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. + + +* Go + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +* SLATEC Common Mathematical Library + +Public domain. + + +* ESLint + +Copyright JS Foundation and other contributors, https://js.foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +* StatsFuns.jl + +Copyright (c) 2015: Dahua Lin. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +* SpecialFunctions.jl + +The MIT License (MIT) + +Copyright (c) 2017 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and others: + +https://github.com/JuliaMath/SpecialFunctions.jl/graphs/contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +* MT19937 + +Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..10e6ba1 --- /dev/null +++ b/NOTICE @@ -0,0 +1 @@ +Copyright (c) 2016-2022 The Stdlib Authors. diff --git a/README.md b/README.md new file mode 100644 index 0000000..64f4cac --- /dev/null +++ b/README.md @@ -0,0 +1,1569 @@ + + +# Int8Array + +[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] + +> [Typed array][mdn-typed-array] constructor which returns a [typed array][mdn-typed-array] representing an array of twos-complement 8-bit signed integers in the platform byte order. + + + +
+ +
+ + + + + + + +
+ +## Usage + +To use in Observable, + +```javascript +Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@umd/bundle.js' ) +``` + +To include the bundle in a webpage, + +```html + +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + +``` + +#### Int8Array() + +A [typed array][mdn-typed-array] constructor which returns a [typed array][mdn-typed-array] representing an array of twos-complement 8-bit signed integers in the platform byte order. + + + +```javascript +var arr = new Int8Array(); +// returns +``` + +#### Int8Array( length ) + +Returns a [typed array][mdn-typed-array] having a specified length. + + + +```javascript +var arr = new Int8Array( 5 ); +// returns [ 0, 0, 0, 0, 0 ] +``` + +#### Int8Array( typedarray ) + +Creates a [typed array][mdn-typed-array] from another [typed array][mdn-typed-array]. + + + +```javascript +var Float32Array = require( '@stdlib/array-float32' ); + +var arr1 = new Float32Array( [ 5.0, 5.0, 5.0 ] ); +var arr2 = new Int8Array( arr1 ); +// returns [ 5, 5, 5 ] +``` + +#### Int8Array( obj ) + +Creates a [typed array][mdn-typed-array] from an array-like `object` or iterable. + + + +```javascript +var arr = new Int8Array( [ 5.0, 5.0, 5.0 ] ); +// returns [ 5, 5, 5 ] +``` + +#### Int8Array( buffer\[, byteOffset\[, length]] ) + +Returns a [typed array][mdn-typed-array] view of an [`ArrayBuffer`][@stdlib/array/buffer]. + + + +```javascript +var ArrayBuffer = require( '@stdlib/array-buffer' ); + +var buf = new ArrayBuffer( 4 ); +var arr = new Int8Array( buf, 0, 4 ); +// returns [ 0, 0, 0, 0 ] +``` + +* * * + +### Properties + + + +#### Int8Array.BYTES_PER_ELEMENT + +Number of bytes per view element. + + + +```javascript +var nbytes = Int8Array.BYTES_PER_ELEMENT; +// returns 1 +``` + + + +#### Int8Array.name + +[Typed array][mdn-typed-array] constructor name. + + + +```javascript +var str = Int8Array.name; +// returns 'Int8Array' +``` + + + +#### Int8Array.prototype.buffer + +**Read-only** property which returns the [`ArrayBuffer`][@stdlib/array/buffer] referenced by the [typed array][mdn-typed-array]. + + + +```javascript +var arr = new Int8Array( 5 ); +var buf = arr.buffer; +// returns +``` + + + +#### Int8Array.prototype.byteLength + +**Read-only** property which returns the length (in bytes) of the [typed array][mdn-typed-array]. + + + +```javascript +var arr = new Int8Array( 5 ); +var byteLength = arr.byteLength; +// returns 5 +``` + + + +#### Int8Array.prototype.byteOffset + +**Read-only** property which returns the offset (in bytes) of the [typed array][mdn-typed-array] from the start of its [`ArrayBuffer`][@stdlib/array/buffer]. + + + +```javascript +var arr = new Int8Array( 5 ); +var byteOffset = arr.byteOffset; +// returns 0 +``` + + + +#### Int8Array.prototype.BYTES_PER_ELEMENT + +Number of bytes per view element. + + + +```javascript +var arr = new Int8Array( 5 ); +var nbytes = arr.BYTES_PER_ELEMENT; +// returns 1 +``` + + + +#### Int8Array.prototype.length + +**Read-only** property which returns the number of view elements. + + + +```javascript +var arr = new Int8Array( 5 ); +var len = arr.length; +// returns 5 +``` + +* * * + +### Methods + + + +#### Int8Array.from( src\[, map\[, thisArg]] ) + +Creates a new typed array from an array-like `object` or an iterable. + +```javascript +var arr = Int8Array.from( [ 1, 2 ] ); +// returns [ 1, 2 ] +``` + +To invoke a function for each `src` value, provide a callback function. + +```javascript +function mapFcn( v ) { + return v * 2; +} + +var arr = Int8Array.from( [ 1, 2 ], mapFcn ); +// returns [ 2, 4 ] +``` + +A callback function is provided two arguments: + +- `value`: source value +- `index`: source index + +To set the callback execution context, provide a `thisArg`. + +```javascript +function mapFcn( v ) { + this.count += 1; + return v * 2; +} + +var ctx = { + 'count': 0 +}; + +var arr = Int8Array.from( [ 1, 2 ], mapFcn, ctx ); +// returns [ 2, 4 ] + +var n = ctx.count; +// returns 2 +``` + + + +#### Int8Array.of( element0\[, element1\[, ...elementN]] ) + +Creates a new typed array from a variable number of arguments. + +```javascript +var arr = Int8Array.of( 1, 2 ); +// returns [ 1, 2 ] +``` + + + +#### Int8Array.prototype.copyWithin( target, start\[, end] ) + +Copies a sequence of elements within an array starting at `start` and ending at `end` (non-inclusive) to the position starting at `target`. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3, 4, 5 ] ); + +// Copy the last two elements to the first two elements: +arr.copyWithin( 0, 3 ); + +var v = arr[ 0 ]; +// returns 4 + +v = arr[ 1 ]; +// returns 5 +``` + +By default, `end` equals the number of array elements (i.e., one more than the last array index). To limit the sequence length, provide an `end` argument. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3, 4, 5 ] ); + +// Copy the first two elements to the last two elements: +arr.copyWithin( 3, 0, 2 ); + +var v = arr[ 3 ]; +// returns 1 + +v = arr[ 4 ]; +// returns 2 +``` + +When a `target`, `start`, and/or `end` index is negative, the respective index is determined relative to the last array element. The following example achieves the same behavior as the previous example: + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3, 4, 5 ] ); + +// Copy the first two elements to the last two elements: +arr.copyWithin( -2, -5, -3 ); + +var v = arr[ 3 ]; +// returns 1 + +v = arr[ 4 ]; +// returns 2 +``` + + + +#### Int8Array.prototype.entries() + +Returns an iterator for iterating over array key-value pairs. + + + +```javascript +var arr = new Int8Array( [ 1, 2 ] ); + +// Create an iterator: +var it = arr.entries(); + +// Iterate over key-value pairs... +var v = it.next().value; +// returns [ 0, 1 ] + +v = it.next().value; +// returns [ 1, 2 ] + +var bool = it.next().done; +// returns true +``` + + + +#### Int8Array.prototype.every( predicate\[, thisArg] ) + +Tests whether all array elements pass a test implemented by a `predicate` function. + + + +```javascript +function predicate( v ) { + return ( v <= 1 ); +} + +var arr = new Int8Array( [ 1, 2 ] ); + +var bool = arr.every( predicate ); +// returns false +``` + +A `predicate` function is provided three arguments: + +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + +To set the callback execution context, provide a `thisArg`. + + + +```javascript +function predicate( v ) { + this.count += 1; + return ( v >= 1 ); +} + +var ctx = { + 'count': 0 +}; + +var arr = new Int8Array( [ 1, 2 ] ); + +var bool = arr.every( predicate, ctx ); +// returns true + +var n = ctx.count; +// returns 2 +``` + + + +#### Int8Array.prototype.fill( value\[, start\[, end]] ) + +Fills an array from a `start` index to an `end` index (non-inclusive) with a provided `value`. + + + +```javascript +var arr = new Int8Array( 2 ); + +// Set all array elements to the same value: +arr.fill( 2 ); + +var v = arr[ 0 ]; +// returns 2 + +v = arr[ 1 ]; +// returns 2 + +// Set all array elements starting from the first index to the same value: +arr.fill( 3, 1 ); + +v = arr[ 0 ]; +// returns 2 + +v = arr[ 1 ]; +// returns 3 + +// Set all array elements, except the last element, to the same value: +arr.fill( 4, 0, arr.length-1 ); + +v = arr[ 0 ]; +// returns 4 + +v = arr[ 1 ]; +// returns 3 +``` + +When a `start` and/or `end` index is negative, the respective index is determined relative to the last array element. + + + +```javascript +var arr = new Int8Array( 2 ); + +// Set all array elements, except the last element, to the same value: +arr.fill( 2, -arr.length, -1 ); + +var v = arr[ 0 ]; +// returns 2 + +v = arr[ 1 ]; +// returns 0 +``` + + + +#### Int8Array.prototype.filter( predicate\[, thisArg] ) + +Creates a new array (of the same data type as the host array) which includes those elements for which a `predicate` function returns a truthy value. + + + +```javascript +function predicate( v ) { + return ( v >= 2 ); +} + +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.filter( predicate ); +// returns [ 2, 3 ] +``` + +If a `predicate` function does not return a truthy value for any array element, the method returns an empty array. + + + +```javascript +function predicate( v ) { + return ( v >= 10 ); +} + +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.filter( predicate ); +// returns [] +``` + +A `predicate` function is provided three arguments: + +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + +To set the callback execution context, provide a `thisArg`. + + + +```javascript +function predicate( v ) { + this.count += 1; + return ( v >= 2 ); +} + +var ctx = { + 'count': 0 +}; + +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.filter( predicate, ctx ); + +var n = ctx.count; +// returns 3 +``` + + + +#### Int8Array.prototype.find( predicate\[, thisArg] ) + +Returns the first array element for which a provided `predicate` function returns a truthy value. + + + +```javascript +function predicate( v ) { + return ( v > 2 ); +} + +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var v = arr.find( predicate ); +// returns 3 +``` + +If a `predicate` function does not return a truthy value for any array element, the method returns `undefined`. + + + +```javascript +function predicate( v ) { + return ( v < 1 ); +} + +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var v = arr.find( predicate ); +// returns undefined +``` + +A `predicate` function is provided three arguments: + +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + +To set the callback execution context, provide a `thisArg`. + + + +```javascript +function predicate( v ) { + this.count += 1; + return ( v > 2 ); +} + +var ctx = { + 'count': 0 +}; + +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var v = arr.find( predicate, ctx ); +// returns 3 + +var n = ctx.count; +// returns 3 +``` + + + +#### Int8Array.prototype.findIndex( predicate\[, thisArg] ) + +Returns the index of the first array element for which a provided `predicate` function returns a truthy value. + + + +```javascript +function predicate( v ) { + return ( v >= 3 ); +} + +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var idx = arr.findIndex( predicate ); +// returns 2 +``` + +If a `predicate` function does not return a truthy value for any array element, the method returns `-1`. + + + +```javascript +function predicate( v ) { + return ( v < 1 ); +} + +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var idx = arr.findIndex( predicate ); +// returns -1 +``` + +A `predicate` function is provided three arguments: + +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + +To set the callback execution context, provide a `thisArg`. + + + +```javascript +function predicate( v ) { + this.count += 1; + return ( v >= 3 ); +} + +var ctx = { + 'count': 0 +}; + +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var idx = arr.findIndex( predicate, ctx ); +// returns 2 + +var n = ctx.count; +// returns 3 +``` + + + +#### Int8Array.prototype.forEach( fcn\[, thisArg] ) + +Invokes a callback for each array element. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var str = ''; + +function fcn( v, i ) { + str += i + ':' + v; + if ( i < arr.length-1 ) { + str += ' '; + } +} + +arr.forEach( fcn ); + +console.log( str ); +// => '0:1 1:2 2:3' +``` + +The callback is provided three arguments: + +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + +To set the callback execution context, provide a `thisArg`. + + + +```javascript +function fcn() { + this.count += 1; +} + +var ctx = { + 'count': 0 +}; + +var arr = new Int8Array( [ 1, 2, 3 ] ); + +arr.forEach( fcn, ctx ); + +var n = ctx.count; +// returns 3 +``` + + + +#### Int8Array.prototype.includes( searchElement\[, fromIndex] ) + +Returns a `boolean` indicating whether an array includes a search element. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var bool = arr.includes( 3 ); +// returns true + +bool = arr.includes( 0 ); +// returns false +``` + +By default, the method searches the entire array (`fromIndex = 0`). To begin searching from a specific array index, provide a `fromIndex`. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var bool = arr.includes( 1, 1 ); +// returns false +``` + +When a `fromIndex` is negative, the starting index is resolved relative to the last array element. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +bool = arr.includes( 1, -2 ); +// returns false +``` + + + +#### Int8Array.prototype.indexOf( searchElement\[, fromIndex] ) + +Returns the index of the first array element strictly equal to a search element. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var idx = arr.indexOf( 3 ); +// returns 2 + +idx = arr.indexOf( 0 ); +// returns -1 +``` + +By default, the method searches the entire array (`fromIndex = 0`). To begin searching from a specific array index, provide a `fromIndex`. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var idx = arr.indexOf( 1, 1 ); +// returns -1 +``` + +When a `fromIndex` is negative, the starting index is resolved relative to the last array element. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var idx = arr.indexOf( 1, -2 ); +// returns -1 +``` + + + +#### Int8Array.prototype.join( \[separator] ) + +Serializes an array by joining all array elements as a string. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var str = arr.join(); +// returns '1,2,3' +``` + +By default, the method delineates array elements using a comma `,`. To specify a custom separator, provide a `separator` string. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var str = arr.join( '|' ); +// returns '1|2|3' +``` + + + +#### Int8Array.prototype.keys() + +Returns an iterator for iterating over array keys. + + + +```javascript +var arr = new Int8Array( [ 1, 2 ] ); + +// Create an iterator: +var it = arr.keys(); + +// Iterate over keys... +var v = it.next().value; +// returns 0 + +v = it.next().value; +// returns 1 + +var bool = it.next().done; +// returns true +``` + + + +#### Int8Array.prototype.lastIndexOf( searchElement\[, fromIndex] ) + +Returns the index of the last array element strictly equal to a search element, iterating from right to left. + + + +```javascript +var arr = new Int8Array( [ 1, 0, 2, 0, 1 ] ); + +var idx = arr.lastIndexOf( 0 ); +// returns 3 + +idx = arr.lastIndexOf( 3 ); +// returns -1 +``` + +By default, the method searches the entire array (`fromIndex = -1`). To begin searching from a specific array index, provide a `fromIndex`. + + + +```javascript +var arr = new Int8Array( [ 1, 0, 2, 0, 1 ] ); + +var idx = arr.lastIndexOf( 0, 2 ); +// returns 1 +``` + +When a `fromIndex` is negative, the starting index is resolved relative to the last array element. + + + +```javascript +var arr = new Int8Array( [ 1, 0, 2, 0, 1 ] ); + +var idx = arr.lastIndexOf( 0, -3 ); +// returns 1 +``` + + + +#### Int8Array.prototype.map( fcn\[, thisArg] ) + +Maps each array element to an element in a new array having the same data type as the host array. + + + +```javascript +function fcn( v ) { + return v * 2; +} + +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.map( fcn ); +// returns [ 2, 4, 6 ] +``` + +A callback is provided three arguments: + +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + +To set the callback execution context, provide a `thisArg`. + + + +```javascript +function fcn( v ) { + this.count += 1; + return v * 2; +} + +var ctx = { + 'count': 0 +}; + +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.map( fcn, ctx ); + +var n = ctx.count; +// returns 3 +``` + + + +#### Int8Array.prototype.reduce( fcn\[, initialValue] ) + +Applies a function against an accumulator and each element in an array and returns the accumulated result. + + + +```javascript +function fcn( acc, v ) { + return acc + ( v*v ); +} + +var arr = new Int8Array( [ 2, 1, 3 ] ); + +var v = arr.reduce( fcn ); +// returns 12 +``` + +If not provided an initial value, the method invokes a provided function with the first array element as the first argument and the second array element as the second argument. + +If provided an initial value, the method invokes a provided function with the initial value as the first argument and the first array element as the second argument. + + + +```javascript +function fcn( acc, v ) { + return acc + ( v*v ); +} + +var arr = new Int8Array( [ 2, 1, 3 ] ); + +var v = arr.reduce( fcn, 0 ); +// returns 14 +``` + +A callback is provided four arguments: + +- `acc`: accumulated result +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + + + +#### Int8Array.prototype.reduceRight( fcn\[, initialValue] ) + +Applies a function against an accumulator and each element in an array and returns the accumulated result, iterating from right to left. + + + +```javascript +function fcn( acc, v ) { + return acc + ( v*v ); +} + +var arr = new Int8Array( [ 2, 1, 3 ] ); + +var v = arr.reduceRight( fcn ); +// returns 8 +``` + +If not provided an initial value, the method invokes a provided function with the last array element as the first argument and the second-to-last array element as the second argument. + +If provided an initial value, the method invokes a provided function with the initial value as the first argument and the last array element as the second argument. + + + +```javascript +function fcn( acc, v ) { + return acc + ( v*v ); +} + +var arr = new Int8Array( [ 2, 1, 3 ] ); + +var v = arr.reduce( fcn, 0 ); +// returns 14 +``` + +A callback is provided four arguments: + +- `acc`: accumulated result +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + + + +#### Int8Array.prototype.reverse() + +Reverses an array **in-place** (thus mutating the array on which the method is invoked). + + + +```javascript +var arr = new Int8Array( [ 2, 0, 3 ] ); + +// Reverse the array: +arr.reverse(); + +var v = arr[ 0 ]; +// returns 3 + +v = arr[ 1 ]; +// returns 0 + +v = arr[ 2 ]; +// returns 2 +``` + + + +#### Int8Array.prototype.set( arr\[, offset] ) + +Sets array elements. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); +// returns [ 1, 2, 3 ] + +// Set the first two array elements: +arr.set( [ 4, 5 ] ); + +var v = arr[ 0 ]; +// returns 4 + +v = arr[ 1 ]; +// returns 5 +``` + +By default, the method starts writing values at the first array index. To specify an alternative index, provide an index `offset`. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); +// returns [ 1, 2, 3 ] + +// Set the last two array elements: +arr.set( [ 4, 5 ], 1 ); + +var v = arr[ 1 ]; +// returns 4 + +v = arr[ 2 ]; +// returns 5 +``` + + + +#### Int8Array.prototype.slice( \[begin\[, end]] ) + +Copies array elements to a new array with the same underlying data type as the host array. + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.slice(); + +var bool = ( arr1 === arr2 ); +// returns false + +bool = ( arr1.buffer === arr2.buffer ); +// returns false + +var v = arr2[ 0 ]; +// returns 1 + +v = arr2[ 1 ]; +// returns 2 + +v = arr2[ 2 ]; +// returns 3 +``` + +By default, the method copies elements beginning with the first array element. To specify an alternative array index at which to begin copying, provide a `begin` index (inclusive). + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.slice( 1 ); + +var len = arr2.length; +// returns 2 + +var v = arr2[ 0 ]; +// returns 2 + +v = arr2[ 1 ]; +// returns 3 +``` + +By default, the method copies all array elements after `begin`. To specify an alternative array index at which to end copying, provide an `end` index (exclusive). + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.slice( 0, 2 ); + +var len = arr2.length; +// returns 2 + +var v = arr2[ 0 ]; +// returns 1 + +v = arr2[ 1 ]; +// returns 2 +``` + +When a `begin` and/or `end` index is negative, the respective index is determined relative to the last array element. + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.slice( -arr1.length, -1 ); + +var len = arr2.length; +// returns 2 + +var v = arr2[ 0 ]; +// returns 1 + +v = arr2[ 1 ]; +// returns 2 +``` + + + +#### Int8Array.prototype.some( predicate\[, thisArg] ) + +Tests whether at least one array element passes a test implemented by a `predicate` function. + + + +```javascript +function predicate( v ) { + return ( v >= 2 ); +} + +var arr = new Int8Array( [ 1, 2 ] ); + +var bool = arr.some( predicate ); +// returns true +``` + +A `predicate` function is provided three arguments: + +- `value`: array element +- `index`: array index +- `arr`: array on which the method is invoked + +To set the callback execution context, provide a `thisArg`. + + + +```javascript +function predicate( v ) { + this.count += 1; + return ( v >= 2 ); +} + +var ctx = { + 'count': 0 +}; + +var arr = new Int8Array( [ 1, 1 ] ); + +var bool = arr.some( predicate, ctx ); +// returns false + +var n = ctx.count; +// returns 2 +``` + + + +#### Int8Array.prototype.sort( \[compareFunction] ) + +Sorts an array **in-place** (thus mutating the array on which the method is invoked). + + + +```javascript +var arr = new Int8Array( [ 2, 3, 0 ] ); + +// Sort the array (in ascending order): +arr.sort(); + +var v = arr[ 0 ]; +// returns 0 + +v = arr[ 1 ]; +// returns 2 + +v = arr[ 2 ]; +// returns 3 +``` + +By default, the method sorts array elements in ascending order. To impose a custom order, provide a `compareFunction`. + + + +```javascript +function descending( a, b ) { + return b - a; +} + +var arr = new Int8Array( [ 2, 3, 0 ] ); + +// Sort the array (in descending order): +arr.sort( descending ); + +var v = arr[ 0 ]; +// returns 3 + +v = arr[ 1 ]; +// returns 2 + +v = arr[ 2 ]; +// returns 0 +``` + +The comparison function is provided two array elements, `a` and `b`, per invocation, and its return value determines the sort order as follows: + +- If the comparison function returns a value **less** than zero, then the method sorts `a` to an index lower than `b` (i.e., `a` should come **before** `b`). +- If the comparison function returns a value **greater** than zero, then the method sorts `a` to an index higher than `b` (i.e., `b` should come **before** `a`). +- If the comparison function returns **zero**, then the relative order of `a` and `b` _should_ remain unchanged. + + + +#### Int8Array.prototype.subarray( \[begin\[, end]] ) + +Creates a new typed array view over the same underlying [`ArrayBuffer`][@stdlib/array/buffer] and with the same underlying data type as the host array. + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.subarray(); +// returns [ 1, 2, 3 ] + +var bool = ( arr1.buffer === arr2.buffer ); +// returns true +``` + +By default, the method creates a typed array view beginning with the first array element. To specify an alternative array index at which to begin, provide a `begin` index (inclusive). + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.subarray( 1 ); +// returns [ 2, 3 ] + +var bool = ( arr1.buffer === arr2.buffer ); +// returns true +``` + +By default, the method creates a typed array view which includes all array elements after `begin`. To limit the number of array elements after `begin`, provide an `end` index (exclusive). + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.subarray( 0, 2 ); +// returns [ 1, 2 ] + +var bool = ( arr1.buffer === arr2.buffer ); +// returns true +``` + +When a `begin` and/or `end` index is negative, the respective index is determined relative to the last array element. + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.subarray( -arr1.length, -1 ); +// returns [ 1, 2 ] + +var bool = ( arr1.buffer === arr2.buffer ); +// returns true +``` + +If the method is unable to resolve indices to a non-empty array subsequence, the method returns an empty typed array. + + + +```javascript +var arr1 = new Int8Array( [ 1, 2, 3 ] ); + +var arr2 = arr1.subarray( 10, -1 ); +// returns [] +``` + + + +#### Int8Array.prototype.toLocaleString( \[locales\[, options]] ) + +Serializes an array as a locale-specific `string`. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var str = arr.toLocaleString(); +// returns '1,2,3' +``` + + + +#### Int8Array.prototype.toString() + +Serializes an array as a `string`. + + + +```javascript +var arr = new Int8Array( [ 1, 2, 3 ] ); + +var str = arr.toString(); +// returns '1,2,3' +``` + + + +#### Int8Array.prototype.values() + +Returns an iterator for iterating over array elements. + + + +```javascript +var arr = new Int8Array( [ 1, 2 ] ); + +// Create an iterator: +var it = arr.values(); + +// Iterate over array elements... +var v = it.next().value; +// returns 1 + +v = it.next().value; +// returns 2 + +var bool = it.next().done; +// returns true +``` + +
+ + + +* * * + + + +
+ +
+ + + + + +
+ +## Examples + + + +```html + + + + + + + + + +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + +
+ +* * * + +## Notice + +This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. + +For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. + +#### Community + +[![Chat][chat-image]][chat-url] + +--- + +## License + +See [LICENSE][stdlib-license]. + + +## Copyright + +Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. + +
+ + + + + + + + diff --git a/bundle.js b/bundle.js new file mode 100644 index 0000000..d7cf820 --- /dev/null +++ b/bundle.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n()}(this,(function(){"use strict";var t=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();var n=function(){return t&&"symbol"==typeof Symbol.toStringTag},r=Object.prototype.toString,o=r;var e=function(t){return o.call(t)},f=Object.prototype.hasOwnProperty;var u=function(t,n){return null!=t&&f.call(t,n)},i="function"==typeof Symbol?Symbol.toStringTag:"",c=u,l=i,y=r;var a=e,p=function(t){var n,r,o;if(null==t)return y.call(t);r=t[l],n=c(t,l);try{t[l]=void 0}catch(n){return y.call(t)}return o=y.call(t),n?t[l]=r:delete t[l],o},d=n()?p:a,b="function"==typeof Int8Array;var m="function"==typeof Int8Array?Int8Array:null,s=function(t){return b&&t instanceof Int8Array||"[object Int8Array]"===d(t)},v=m;var A="function"==typeof Int8Array?Int8Array:void 0,I=function(){throw new Error("not implemented")};return function(){var t,n;if("function"!=typeof v)return!1;try{n=new v([1,3.14,-3.14,128]),t=s(n)&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?A:I})); +//# sourceMappingURL=bundle.js.map diff --git a/bundle.js.map b/bundle.js.map new file mode 100644 index 0000000..1d1f8be --- /dev/null +++ b/bundle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.js","sources":["../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-tostringtag-support/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/utils-native-class/lib/native_class.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/assert-has-own-property/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../lib/polyfill.js","../lib/index.js","../lib/int8array.js","../node_modules/@stdlib/constants-int8-min/lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasSymbols = require( '@stdlib/assert-has-symbol-support' );\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `toStringTag` support.\n*\n* @module @stdlib/assert-has-tostringtag-support\n*\n* @example\n* var hasToStringTagSupport = require( '@stdlib/assert-has-tostringtag-support' );\n*\n* var bool = hasToStringTagSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasToStringTagSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nmodule.exports = toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object has a specified property.\n*\n* @module @stdlib/assert-has-own-property\n*\n* @example\n* var hasOwnProp = require( '@stdlib/assert-has-own-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* bool = hasOwnProp( beep, 'bop' );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasOwnProp = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nmodule.exports = toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar toStringTag = require( './tostringtag.js' );\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* var nativeClass = require( '@stdlib/utils-native-class' );\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar builtin = require( './native_class.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt8Array = require( '@stdlib/assert-is-int8array' );\nvar INT8_MAX = require( '@stdlib/constants-int8-max' );\nvar INT8_MIN = require( '@stdlib/constants-int8-min' );\nvar GlobalInt8Array = require( './int8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './int8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* var INT8_MIN = require( '@stdlib/constants-int8-min' );\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT8_MIN;\n"],"names":["FLG","Symbol","hasSymbols","lib","toStringTag","tostring","Object","prototype","toString","toStr","require$$0","native_class","v","call","has","hasOwnProperty","value","property","toStrTag","hasOwnProp","require$$2","builtin","require$$1","polyfill","isOwn","tag","out","err","nativeClass","hasInt8Array","Int8Array","main","isInt8Array","GlobalInt8Array","Error","bool","arr","INT8_MAX","hasInt8ArraySupport"],"mappings":";0OAyCA,ICdIA,EDIJ,WACC,MACmB,mBAAXC,QACoB,iBAApBA,OAAQ,OCPPC,GAqBV,ICTAC,EDEA,WACC,OAASH,GAAqC,iBAAvBC,OAAOG,aEf/BC,EALYC,OAAOC,UAAUC,SCAzBC,EAAQC,EAiCZ,IAAAC,EAPA,SAAsBC,GACrB,OAAOH,EAAMI,KAAMD,IC3BhBE,EAAMR,OAAOC,UAAUQ,eAyC3B,ICjBAZ,EDIA,SAAqBa,EAAOC,GAC3B,OACCD,MAAAA,GAKMF,EAAID,KAAMG,EAAOC,IEnCrBC,EAA+B,mBAAXjB,OAA0BA,OAAOG,YAAc,GCAnEe,EAAaT,EACbN,EDIac,ECHbT,EAAQW,EAwDZ,ICpCIC,EAAUC,EACVC,EDKJ,SAAsBX,GACrB,IAAIY,EACAC,EACAC,EAEJ,GAAKd,MAAAA,EACJ,OAAOH,EAAMI,KAAMD,GAEpBa,EAAMb,EAAGR,GACToB,EAAQL,EAAYP,EAAGR,GAGvB,IACCQ,EAAGR,QAAgB,EAClB,MAAQuB,GACT,OAAOlB,EAAMI,KAAMD,GASpB,OAPAc,EAAMjB,EAAMI,KAAMD,GAEbY,EACJZ,EAAGR,GAAgBqB,SAEZb,EAAGR,GAEJsB,GEpDJE,EDqBiBlB,IASNa,EAEAF,EC3BXQ,EAAsC,mBAAdC,UA6B5B,IClCIC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EFwBJ,SAAsBhB,GACrB,OACGa,GAAgBb,aAAiBc,WACV,uBAAzBF,EAAaZ,IExBXiB,EDEaF,EESjB,ICDIV,ECb8B,mBAAdS,UAA6BA,eAAY,EDczDP,EDPJ,WACC,MAAM,IAAIW,MAAO,2BDSlB,WACC,IAAIC,EACAC,EAEJ,GAAgC,mBAApBH,EACX,OAAO,EAGR,IACCG,EAAM,IAAIH,EAAiB,CAAE,EAAG,MAAO,KAAMI,MAC7CF,EACCH,EAAaI,IACA,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KIEO,MJDZA,EAAK,GAEL,MAAQT,GACTQ,GAAO,EAER,OAAOA,EEjBHG,GACGjB,EAEAE"} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..02c23d7 --- /dev/null +++ b/package.json @@ -0,0 +1,37 @@ +{ + "name": "@stdlib/array-int8", + "version": "0.0.0", + "description": "Int8Array.", + "license": "Apache-2.0", + "main": "./bundle.js", + "homepage": "https://stdlib.io", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/array-int8.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "keywords": [ + "stdlib", + "stdtypes", + "types", + "data", + "structure", + "array", + "typed", + "typed array", + "typed-array", + "int8array", + "int8", + "int8_t", + "integer", + "int", + "signed", + "byte" + ], + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/athan" + } +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..80c1166 --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + From 22b9c875a0e6a55eec9d56e6b9a42d699388022d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 07:12:59 +0000 Subject: [PATCH 002/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 4a7520f..b45b083 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 1af8136d736636a920f8a096038a428e79f7aa4f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 20:53:36 +0000 Subject: [PATCH 003/145] Remove files --- bundle.js | 3 - bundle.js.map | 1 - stats.html | 2689 ------------------------------------------------- 3 files changed, 2693 deletions(-) delete mode 100644 bundle.js delete mode 100644 bundle.js.map delete mode 100644 stats.html diff --git a/bundle.js b/bundle.js deleted file mode 100644 index d7cf820..0000000 --- a/bundle.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n()}(this,(function(){"use strict";var t=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();var n=function(){return t&&"symbol"==typeof Symbol.toStringTag},r=Object.prototype.toString,o=r;var e=function(t){return o.call(t)},f=Object.prototype.hasOwnProperty;var u=function(t,n){return null!=t&&f.call(t,n)},i="function"==typeof Symbol?Symbol.toStringTag:"",c=u,l=i,y=r;var a=e,p=function(t){var n,r,o;if(null==t)return y.call(t);r=t[l],n=c(t,l);try{t[l]=void 0}catch(n){return y.call(t)}return o=y.call(t),n?t[l]=r:delete t[l],o},d=n()?p:a,b="function"==typeof Int8Array;var m="function"==typeof Int8Array?Int8Array:null,s=function(t){return b&&t instanceof Int8Array||"[object Int8Array]"===d(t)},v=m;var A="function"==typeof Int8Array?Int8Array:void 0,I=function(){throw new Error("not implemented")};return function(){var t,n;if("function"!=typeof v)return!1;try{n=new v([1,3.14,-3.14,128]),t=s(n)&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?A:I})); -//# sourceMappingURL=bundle.js.map diff --git a/bundle.js.map b/bundle.js.map deleted file mode 100644 index 1d1f8be..0000000 --- a/bundle.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.js","sources":["../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-tostringtag-support/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/utils-native-class/lib/native_class.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/assert-has-own-property/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../lib/polyfill.js","../lib/index.js","../lib/int8array.js","../node_modules/@stdlib/constants-int8-min/lib/index.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasSymbols = require( '@stdlib/assert-has-symbol-support' );\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `toStringTag` support.\n*\n* @module @stdlib/assert-has-tostringtag-support\n*\n* @example\n* var hasToStringTagSupport = require( '@stdlib/assert-has-tostringtag-support' );\n*\n* var bool = hasToStringTagSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasToStringTagSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nmodule.exports = toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object has a specified property.\n*\n* @module @stdlib/assert-has-own-property\n*\n* @example\n* var hasOwnProp = require( '@stdlib/assert-has-own-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* bool = hasOwnProp( beep, 'bop' );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasOwnProp = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nmodule.exports = toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar toStringTag = require( './tostringtag.js' );\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* var nativeClass = require( '@stdlib/utils-native-class' );\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar builtin = require( './native_class.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt8Array = require( '@stdlib/assert-is-int8array' );\nvar INT8_MAX = require( '@stdlib/constants-int8-max' );\nvar INT8_MIN = require( '@stdlib/constants-int8-min' );\nvar GlobalInt8Array = require( './int8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './int8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* var INT8_MIN = require( '@stdlib/constants-int8-min' );\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT8_MIN;\n"],"names":["FLG","Symbol","hasSymbols","lib","toStringTag","tostring","Object","prototype","toString","toStr","require$$0","native_class","v","call","has","hasOwnProperty","value","property","toStrTag","hasOwnProp","require$$2","builtin","require$$1","polyfill","isOwn","tag","out","err","nativeClass","hasInt8Array","Int8Array","main","isInt8Array","GlobalInt8Array","Error","bool","arr","INT8_MAX","hasInt8ArraySupport"],"mappings":";0OAyCA,ICdIA,EDIJ,WACC,MACmB,mBAAXC,QACoB,iBAApBA,OAAQ,OCPPC,GAqBV,ICTAC,EDEA,WACC,OAASH,GAAqC,iBAAvBC,OAAOG,aEf/BC,EALYC,OAAOC,UAAUC,SCAzBC,EAAQC,EAiCZ,IAAAC,EAPA,SAAsBC,GACrB,OAAOH,EAAMI,KAAMD,IC3BhBE,EAAMR,OAAOC,UAAUQ,eAyC3B,ICjBAZ,EDIA,SAAqBa,EAAOC,GAC3B,OACCD,MAAAA,GAKMF,EAAID,KAAMG,EAAOC,IEnCrBC,EAA+B,mBAAXjB,OAA0BA,OAAOG,YAAc,GCAnEe,EAAaT,EACbN,EDIac,ECHbT,EAAQW,EAwDZ,ICpCIC,EAAUC,EACVC,EDKJ,SAAsBX,GACrB,IAAIY,EACAC,EACAC,EAEJ,GAAKd,MAAAA,EACJ,OAAOH,EAAMI,KAAMD,GAEpBa,EAAMb,EAAGR,GACToB,EAAQL,EAAYP,EAAGR,GAGvB,IACCQ,EAAGR,QAAgB,EAClB,MAAQuB,GACT,OAAOlB,EAAMI,KAAMD,GASpB,OAPAc,EAAMjB,EAAMI,KAAMD,GAEbY,EACJZ,EAAGR,GAAgBqB,SAEZb,EAAGR,GAEJsB,GEpDJE,EDqBiBlB,IASNa,EAEAF,EC3BXQ,EAAsC,mBAAdC,UA6B5B,IClCIC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EFwBJ,SAAsBhB,GACrB,OACGa,GAAgBb,aAAiBc,WACV,uBAAzBF,EAAaZ,IExBXiB,EDEaF,EESjB,ICDIV,ECb8B,mBAAdS,UAA6BA,eAAY,EDczDP,EDPJ,WACC,MAAM,IAAIW,MAAO,2BDSlB,WACC,IAAIC,EACAC,EAEJ,GAAgC,mBAApBH,EACX,OAAO,EAGR,IACCG,EAAM,IAAIH,EAAiB,CAAE,EAAG,MAAO,KAAMI,MAC7CF,EACCH,EAAaI,IACA,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KIEO,MJDZA,EAAK,GAEL,MAAQT,GACTQ,GAAO,EAER,OAAOA,EEjBHG,GACGjB,EAEAE"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 80c1166..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 52edb57a8891034711dc551e72a714e9fab82ac6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 20:54:28 +0000 Subject: [PATCH 004/145] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 33 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 681 ----- .github/workflows/publish.yml | 157 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 -- benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ------ docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/int8array.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 2689 +++++++++++++++++ stats_node.html | 2689 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 5434 insertions(+), 9057 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/int8array.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 040114d..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-07-01T00:54:50.874Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 128c22e..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,681 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the repository: - push: - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf - - git add -A - git commit -m "Remove files" - - git merge -s recursive -X theirs origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch or create new branch tag: - - name: 'Push changes to `deno` branch or create new branch tag' - run: | - SLUG=${{ github.repository }} - VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p') - if [ -z "$VERSION" ]; then - echo "Workflow job was not triggered by a new tag...." - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - else - echo "Workflow job was triggered by a new tag: $VERSION" - echo "Creating new bundle branch tag of the form $VERSION-deno" - git tag -a $VERSION-deno -m "$VERSION-deno" - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno - fi - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf - - git add -A - git commit -m "Remove files" - - git merge -s recursive -X theirs origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..c221f2d --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=r()}(this,(function(){"use strict";function t(t){var r=t.default;if("function"==typeof r){var n=function(){return r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var e=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,e.get?e:{enumerable:!0,get:function(){return t[r]}})})),n}var r=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();var n=function(){return r&&"symbol"==typeof Symbol.toStringTag},e=Object.prototype.toString,o=e;var i=function(t){return o.call(t)},u=Object.prototype.hasOwnProperty;var f=function(t,r){return null!=t&&u.call(t,r)},a="function"==typeof Symbol?Symbol.toStringTag:"",c=f,s=a,l=e;var h=i,p=function(t){var r,n,e;if(null==t)return l.call(t);n=t[s],r=c(t,s);try{t[s]=void 0}catch(r){return l.call(t)}return e=l.call(t),r?t[s]=n:delete t[s],e},y=n()?p:h,v=y,g="function"==typeof Int8Array;var w="function"==typeof Int8Array?Int8Array:null,d=function(t){return g&&t instanceof Int8Array||"[object Int8Array]"===v(t)},b=w;var m=function(){var t,r;if("function"!=typeof b)return!1;try{r=new b([1,3.14,-3.14,128]),t=d(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t},A=m,E="function"==typeof Int8Array?Int8Array:void 0,_="function"==typeof Object.defineProperty?Object.defineProperty:null;var O=function(){try{return _({},"x",{}),!0}catch(t){return!1}},P=Object.defineProperty,j=Object.prototype,R=j.toString,T=j.__defineGetter__,U=j.__defineSetter__,I=j.__lookupGetter__,S=j.__lookupSetter__;var B=function(t,r,n){var e,o,i,u;if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof n||null===n||"[object Array]"===R.call(n))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+n+"`.");if((o="value"in n)&&(I.call(t,r)||S.call(t,r)?(e=t.__proto__,t.__proto__=j,delete t[r],t[r]=n.value,t.__proto__=e):t[r]=n.value),i="get"in n,u="set"in n,o&&(i||u))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return i&&T&&T.call(t,r,n.get),u&&U&&U.call(t,r,n.set),t},Y=P,x=B,C=O()?Y:x,M=C;var L=function(t,r,n){M(t,r,{configurable:!1,enumerable:!1,writable:!1,value:n})},F=L;var D=function(t){return"string"==typeof t},N=String.prototype.valueOf;var k=y,V=function(t){try{return N.call(t),!0}catch(t){return!1}},z=n();var G=function(t){return"object"==typeof t&&(t instanceof String||(z?V(t):"[object String]"===k(t)))},X=D,$=G;var H=F,W=function(t){return X(t)||$(t)},q=G;H(W,"isPrimitive",D),H(W,"isObject",q);var J=W,Z=J.isPrimitive,K=/[-\/\\^$*+?.()|[\]{}]/g;var Q=function(t){var r,n;if(!Z(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");if("/"===t[0])for(n=t.length-1;n>=0&&"/"!==t[n];n--);return void 0===n||n<=0?t.replace(K,"\\$&"):(r=(r=t.substring(1,n)).replace(K,"\\$&"),t=t[0]+r+t.substring(n))},tt=/./;var rt=function(t){return"boolean"==typeof t},nt=Boolean.prototype.toString;var et=y,ot=function(t){try{return nt.call(t),!0}catch(t){return!1}},it=n();var ut=function(t){return"object"==typeof t&&(t instanceof Boolean||(it?ot(t):"[object Boolean]"===et(t)))},ft=rt,at=ut;var ct=F,st=function(t){return ft(t)||at(t)},lt=ut;ct(st,"isPrimitive",rt),ct(st,"isObject",lt);var ht=st;var pt=function(){return new Function("return this;")()},yt="object"==typeof self?self:null,vt="object"==typeof window?window:null,gt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},wt="object"==typeof gt?gt:null;module.exports=wt;var dt=ht.isPrimitive,bt=pt,mt=yt,At=vt,Et=t(Object.freeze({__proto__:null}));var _t=function(t){if(arguments.length){if(!dt(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return bt()}if(mt)return mt;if(At)return At;if(Et)return Et;throw new Error("unexpected error. Unable to resolve global object.")},Ot=_t(),Pt=Ot.document&&Ot.document.childNodes,jt=Int8Array,Rt=tt,Tt=Pt,Ut=jt;var It=function(){return"function"==typeof Rt||"object"==typeof Ut||"function"==typeof Tt};var St=function(){return/^\s*function\s*([^(]*)/i},Bt=St;F(Bt,"REGEXP",St());var Yt=Bt,xt=y;var Ct=Array.isArray?Array.isArray:function(t){return"[object Array]"===xt(t)},Mt=Ct;var Lt=function(t){return null!==t&&"object"==typeof t};F(Lt,"isObjectLikeArray",function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(r){var n,e;if(!Mt(r))return!1;if(0===(n=r.length))return!1;for(e=0;ejr&&Rr(t)},Ur=mr.isPrimitive,Ir=Tr;var Sr=function(t){return Ur(t)&&Ir(t)},Br=mr.isObject,Yr=Tr;var xr=function(t){return Br(t)&&Yr(t.valueOf())},Cr=Sr,Mr=xr;var Lr=F,Fr=function(t){return Cr(t)||Mr(t)},Dr=xr;Lr(Fr,"isPrimitive",Sr),Lr(Fr,"isObject",Dr);var Nr=Fr,kr=Nr.isPrimitive;var Vr=function(t){return kr(t)&&t>=0},zr=Nr.isObject;var Gr=function(t){return zr(t)&&t.valueOf()>=0},Xr=Vr,$r=Gr;var Hr=F,Wr=function(t){return Xr(t)||$r(t)},qr=Gr;Hr(Wr,"isPrimitive",Vr),Hr(Wr,"isObject",qr);var Jr=Wr,Zr=Object.getPrototypeOf;var Kr=function(t){return t.__proto__},Qr=y,tn=Kr;var rn=function(t){var r=tn(t);return r||null===r?r:"[object Function]"===Qr(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null},nn=Zr,en=rn,on=Zt(Object.getPrototypeOf)?nn:en;var un=function(t){return null==t?null:(t=Object(t),on(t))},fn=un,an=y;var cn=function(t){if("object"!=typeof t||null===t)return!1;if(t instanceof Error)return!0;for(;t;){if("[object Error]"===an(t))return!0;t=fn(t)}return!1};var sn=function(){return/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/},ln=sn;F(ln,"REGEXP",sn());var hn=J.isPrimitive,pn=ln;var yn=function(t){if(!hn(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");return(t=pn().exec(t))?new RegExp(t[1],t[2]):null};var vn=function(t){return t!=t},gn=mr.isPrimitive,wn=vn;var dn=function(t){return gn(t)&&wn(t)},bn=mr.isObject,mn=vn;var An=function(t){return bn(t)&&mn(t.valueOf())},En=dn,_n=An;var On=F,Pn=function(t){return En(t)||_n(t)},jn=An;On(Pn,"isPrimitive",dn),On(Pn,"isObject",jn);var Rn=Pn,Tn=Or;var Un=Rn,In=function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Tn(t.length)&&t.length>=0&&t.length<=9007199254740991},Sn=J.isPrimitive,Bn=Nr.isPrimitive;var Yn=function(t,r,n){var e,o;if(!In(t)&&!Sn(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(e=t.length))return-1;if(3===arguments.length){if(!Bn(n))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+n+"`.");if(n>=0){if(n>=e)return-1;o=n}else(o=e+n)<0&&(o=0)}else o=0;if(Un(r)){for(;o=0&&r=0&&t.length<=4294967295&&Qn(t,"callee")&&!te(t,"callee")},oe=ee,ie=Cn,ue=Array.prototype.slice;var fe=function(t){return oe(t)?ie(ue.call(t)):ie(t)};var ae=Kn((function(){}),"prototype"),ce=!Kn({toString:null},"toString");var se,le=function(t){return t.constructor&&t.constructor.prototype===t},he="undefined"==typeof window?void 0:window,pe=f,ye=xn,ve=qt,ge=le,we=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],de=he;se=function(){var t;if("undefined"===ve(de))return!1;for(t in de)try{-1===ye(we,t)&&pe(de,t)&&null!==de[t]&&"object"===ve(de[t])&&ge(de[t])}catch(t){return!0}return!1}();var be="undefined"!=typeof window,me=se,Ae=le,Ee=be;var _e=Ft,Oe=f,Pe=ee,je=ae,Re=ce,Te=function(t){if(!1===Ee&&!me)return Ae(t);try{return Ae(t)}catch(t){return!1}},Ue=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var Ie=Cn,Se=fe,Be=function(t){var r,n,e,o,i,u,f;if(o=[],Pe(t)){for(f=0;f0&&!Oe(t,"0"))for(f=0;f!1})),ze=[],Ge=[],Xe="undefined"!=typeof Uint8Array?Uint8Array:Array,$e=!1;function He(){$e=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=t.length;r>18&63]+ze[o>>12&63]+ze[o>>6&63]+ze[63&o]);return i.join("")}function qe(t){var r;$e||He();for(var n=t.length,e=n%3,o="",i=[],u=16383,f=0,a=n-e;fa?a:f+u));return 1===e?(r=t[n-1],o+=ze[r>>2],o+=ze[r<<4&63],o+="=="):2===e&&(r=(t[n-2]<<8)+t[n-1],o+=ze[r>>10],o+=ze[r>>4&63],o+=ze[r<<2&63],o+="="),i.push(o),i.join("")}function Je(t,r,n,e,o){var i,u,f=8*o-e-1,a=(1<>1,s=-7,l=n?o-1:0,h=n?-1:1,p=t[r+l];for(l+=h,i=p&(1<<-s)-1,p>>=-s,s+=f;s>0;i=256*i+t[r+l],l+=h,s-=8);for(u=i&(1<<-s)-1,i>>=-s,s+=e;s>0;u=256*u+t[r+l],l+=h,s-=8);if(0===i)i=1-c;else{if(i===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,e),i-=c}return(p?-1:1)*u*Math.pow(2,i-e)}function Ze(t,r,n,e,o,i){var u,f,a,c=8*i-o-1,s=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=e?0:i-1,y=e?1:-1,v=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-u))<1&&(u--,a*=2),(r+=u+l>=1?h/a:h*Math.pow(2,1-l))*a>=2&&(u++,a/=2),u+l>=s?(f=0,u=s):u+l>=1?(f=(r*a-1)*Math.pow(2,o),u+=l):(f=r*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[n+p]=255&f,p+=y,f/=256,o-=8);for(u=u<0;t[n+p]=255&u,p+=y,u/=256,c-=8);t[n+p-y]|=128*v}var Ke={}.toString,Qe=Array.isArray||function(t){return"[object Array]"==Ke.call(t)};eo.TYPED_ARRAY_SUPPORT=void 0===gt.TYPED_ARRAY_SUPPORT||gt.TYPED_ARRAY_SUPPORT;var to=ro();function ro(){return eo.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function no(t,r){if(ro()=ro())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ro().toString(16)+" bytes");return 0|t}function co(t){return!(null==t||!t._isBuffer)}function so(t,r){if(co(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Fo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Do(t).length;default:if(e)return Fo(t).length;r=(""+r).toLowerCase(),e=!0}}function lo(t,r,n){var e=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ro(this,r,n);case"utf8":case"utf-8":return _o(this,r,n);case"ascii":return Po(this,r,n);case"latin1":case"binary":return jo(this,r,n);case"base64":return Eo(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),e=!0}}function ho(t,r,n){var e=t[r];t[r]=t[n],t[n]=e}function po(t,r,n,e,o){if(0===t.length)return-1;if("string"==typeof n?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=eo.from(r,e)),co(r))return 0===r.length?-1:yo(t,r,n,e,o);if("number"==typeof r)return r&=255,eo.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):yo(t,[r],n,e,o);throw new TypeError("val must be string, number or Buffer")}function yo(t,r,n,e,o){var i,u=1,f=t.length,a=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(t.length<2||r.length<2)return-1;u=2,f/=2,a/=2,n/=2}function c(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var s=-1;for(i=n;if&&(n=f-a),i=n;i>=0;i--){for(var l=!0,h=0;ho&&(e=o):e=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");e>i/2&&(e=i/2);for(var u=0;u>8,o=n%256,i.push(o),i.push(e);return i}(r,t.length-n),t,n,e)}function Eo(t,r,n){return 0===r&&n===t.length?qe(t):qe(t.slice(r,n))}function _o(t,r,n){n=Math.min(t.length,n);for(var e=[],o=r;o239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(s=c);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&c)<<6|63&i)>127&&(s=a);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(a=(15&c)<<12|(63&i)<<6|63&u)>2047&&(a<55296||a>57343)&&(s=a);break;case 4:i=t[o+1],u=t[o+2],f=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&f)&&(a=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&f)>65535&&a<1114112&&(s=a)}null===s?(s=65533,l=1):s>65535&&(s-=65536,e.push(s>>>10&1023|55296),s=56320|1023&s),e.push(s),o+=l}return function(t){var r=t.length;if(r<=Oo)return String.fromCharCode.apply(String,t);var n="",e=0;for(;e0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},eo.prototype.compare=function(t,r,n,e,o){if(!co(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===e&&(e=0),void 0===o&&(o=this.length),r<0||n>t.length||e<0||o>this.length)throw new RangeError("out of range index");if(e>=o&&r>=n)return 0;if(e>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(e>>>=0),u=(n>>>=0)-(r>>>=0),f=Math.min(i,u),a=this.slice(e,o),c=t.slice(r,n),s=0;so)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var i=!1;;)switch(e){case"hex":return vo(this,t,r,n);case"utf8":case"utf-8":return go(this,t,r,n);case"ascii":return wo(this,t,r,n);case"latin1":case"binary":return bo(this,t,r,n);case"base64":return mo(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ao(this,t,r,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),i=!0}},eo.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Oo=4096;function Po(t,r,n){var e="";n=Math.min(t.length,n);for(var o=r;oe)&&(n=e);for(var o="",i=r;in)throw new RangeError("Trying to access beyond buffer length")}function Io(t,r,n,e,o,i){if(!co(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function So(t,r,n,e){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-n,2);o>>8*(e?o:1-o)}function Bo(t,r,n,e){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-n,4);o>>8*(e?o:3-o)&255}function Yo(t,r,n,e,o,i){if(n+e>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function xo(t,r,n,e,o){return o||Yo(t,0,n,4),Ze(t,r,n,e,23,4),n+4}function Co(t,r,n,e,o){return o||Yo(t,0,n,8),Ze(t,r,n,e,52,8),n+8}eo.prototype.slice=function(t,r){var n,e=this.length;if((t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r0&&(o*=256);)e+=this[t+--r]*o;return e},eo.prototype.readUInt8=function(t,r){return r||Uo(t,1,this.length),this[t]},eo.prototype.readUInt16LE=function(t,r){return r||Uo(t,2,this.length),this[t]|this[t+1]<<8},eo.prototype.readUInt16BE=function(t,r){return r||Uo(t,2,this.length),this[t]<<8|this[t+1]},eo.prototype.readUInt32LE=function(t,r){return r||Uo(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},eo.prototype.readUInt32BE=function(t,r){return r||Uo(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},eo.prototype.readIntLE=function(t,r,n){t|=0,r|=0,n||Uo(t,r,this.length);for(var e=this[t],o=1,i=0;++i=(o*=128)&&(e-=Math.pow(2,8*r)),e},eo.prototype.readIntBE=function(t,r,n){t|=0,r|=0,n||Uo(t,r,this.length);for(var e=r,o=1,i=this[t+--e];e>0&&(o*=256);)i+=this[t+--e]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},eo.prototype.readInt8=function(t,r){return r||Uo(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},eo.prototype.readInt16LE=function(t,r){r||Uo(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},eo.prototype.readInt16BE=function(t,r){r||Uo(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},eo.prototype.readInt32LE=function(t,r){return r||Uo(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},eo.prototype.readInt32BE=function(t,r){return r||Uo(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},eo.prototype.readFloatLE=function(t,r){return r||Uo(t,4,this.length),Je(this,t,!0,23,4)},eo.prototype.readFloatBE=function(t,r){return r||Uo(t,4,this.length),Je(this,t,!1,23,4)},eo.prototype.readDoubleLE=function(t,r){return r||Uo(t,8,this.length),Je(this,t,!0,52,8)},eo.prototype.readDoubleBE=function(t,r){return r||Uo(t,8,this.length),Je(this,t,!1,52,8)},eo.prototype.writeUIntLE=function(t,r,n,e){(t=+t,r|=0,n|=0,e)||Io(this,t,r,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+n},eo.prototype.writeUInt8=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,1,255,0),eo.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},eo.prototype.writeUInt16LE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,2,65535,0),eo.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):So(this,t,r,!0),r+2},eo.prototype.writeUInt16BE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,2,65535,0),eo.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):So(this,t,r,!1),r+2},eo.prototype.writeUInt32LE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,4,4294967295,0),eo.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):Bo(this,t,r,!0),r+4},eo.prototype.writeUInt32BE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,4,4294967295,0),eo.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Bo(this,t,r,!1),r+4},eo.prototype.writeIntLE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);Io(this,t,r,n,o-1,-o)}var i=0,u=1,f=0;for(this[r]=255&t;++i>0)-f&255;return r+n},eo.prototype.writeIntBE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);Io(this,t,r,n,o-1,-o)}var i=n-1,u=1,f=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===f&&0!==this[r+i+1]&&(f=1),this[r+i]=(t/u>>0)-f&255;return r+n},eo.prototype.writeInt8=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,1,127,-128),eo.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},eo.prototype.writeInt16LE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,2,32767,-32768),eo.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):So(this,t,r,!0),r+2},eo.prototype.writeInt16BE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,2,32767,-32768),eo.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):So(this,t,r,!1),r+2},eo.prototype.writeInt32LE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,4,2147483647,-2147483648),eo.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):Bo(this,t,r,!0),r+4},eo.prototype.writeInt32BE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),eo.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Bo(this,t,r,!1),r+4},eo.prototype.writeFloatLE=function(t,r,n){return xo(this,t,r,!0,n)},eo.prototype.writeFloatBE=function(t,r,n){return xo(this,t,r,!1,n)},eo.prototype.writeDoubleLE=function(t,r,n){return Co(this,t,r,!0,n)},eo.prototype.writeDoubleBE=function(t,r,n){return Co(this,t,r,!1,n)},eo.prototype.copy=function(t,r,n,e){if(n||(n=0),e||0===e||(e=this.length),r>=t.length&&(r=t.length),r||(r=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(i<1e3||!eo.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&n<57344){if(!o){if(n>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===e){(r-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(r-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((r-=1)<0)break;i.push(n)}else if(n<2048){if((r-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((r-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Do(t){return function(t){var r,n,e,o,i,u;$e||He();var f=t.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[f-2]?2:"="===t[f-1]?1:0,u=new Xe(3*f/4-i),e=i>0?f-4:f;var a=0;for(r=0,n=0;r>16&255,u[a++]=o>>8&255,u[a++]=255&o;return 2===i?(o=Ge[t.charCodeAt(r)]<<2|Ge[t.charCodeAt(r+1)]>>4,u[a++]=255&o):1===i&&(o=Ge[t.charCodeAt(r)]<<10|Ge[t.charCodeAt(r+1)]<<4|Ge[t.charCodeAt(r+2)]>>2,u[a++]=o>>8&255,u[a++]=255&o),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Mo,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function No(t,r,n,e){for(var o=0;o=r.length||o>=t.length);++o)r[o+n]=t[o];return o}function ko(t){return null!=t&&(!!t._isBuffer||Vo(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Vo(t.slice(0,0))}(t))}function Vo(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var zo=t(Object.freeze({__proto__:null,Buffer:eo,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),eo.alloc(+t)},isBuffer:ko,kMaxLength:to})).Buffer,Go=function(){throw new Error("not implemented")},Xo=Ve()?zo:Go,$o=Zt(Xo.from),Ho=Nt,Wo=Xo;var qo=function(t){if(!Ho(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return Wo.from(t)},Jo=Nt,Zo=Xo;var Ko=function(t){if(!Jo(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return new Zo(t)},Qo=$o?qo:Ko;var ti="function"==typeof Int8Array?Int8Array:void 0,ri=function(){throw new Error("not implemented")},ni=A()?ti:ri,ei=y,oi="function"==typeof Uint8Array;var ii="function"==typeof Uint8Array?Uint8Array:null,ui=function(t){return oi&&t instanceof Uint8Array||"[object Uint8Array]"===ei(t)},fi=ii;var ai=function(){var t,r;if("function"!=typeof fi)return!1;try{r=new fi(r=[1,3.14,-3.14,256,257]),t=ui(r)&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var ci="function"==typeof Uint8Array?Uint8Array:void 0,si=function(){throw new Error("not implemented")},li=ai()?ci:si,hi=y,pi="function"==typeof Uint8ClampedArray;var yi="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null,vi=function(t){return pi&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===hi(t)},gi=yi;var wi=function(){var t,r;if("function"!=typeof gi)return!1;try{r=new gi([-1,0,1,3.14,4.99,255,256]),t=vi(r)&&0===r[0]&&0===r[1]&&1===r[2]&&3===r[3]&&5===r[4]&&255===r[5]&&255===r[6]}catch(r){t=!1}return t};var di="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,bi=function(){throw new Error("not implemented")},mi=wi()?di:bi,Ai=y,Ei="function"==typeof Int16Array;var _i="function"==typeof Int16Array?Int16Array:null,Oi=function(t){return Ei&&t instanceof Int16Array||"[object Int16Array]"===Ai(t)},Pi=_i;var ji=function(){var t,r;if("function"!=typeof Pi)return!1;try{r=new Pi([1,3.14,-3.14,32768]),t=Oi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t};var Ri="function"==typeof Int16Array?Int16Array:void 0,Ti=function(){throw new Error("not implemented")},Ui=ji()?Ri:Ti,Ii=y,Si="function"==typeof Uint16Array;var Bi="function"==typeof Uint16Array?Uint16Array:null,Yi=function(t){return Si&&t instanceof Uint16Array||"[object Uint16Array]"===Ii(t)},xi=Bi;var Ci=function(){var t,r;if("function"!=typeof xi)return!1;try{r=new xi(r=[1,3.14,-3.14,65536,65537]),t=Yi(r)&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var Mi="function"==typeof Uint16Array?Uint16Array:void 0,Li=function(){throw new Error("not implemented")},Fi=Ci()?Mi:Li,Di=y,Ni="function"==typeof Int32Array;var ki="function"==typeof Int32Array?Int32Array:null,Vi=function(t){return Ni&&t instanceof Int32Array||"[object Int32Array]"===Di(t)},zi=ki;var Gi=function(){var t,r;if("function"!=typeof zi)return!1;try{r=new zi([1,3.14,-3.14,2147483648]),t=Vi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t};var Xi="function"==typeof Int32Array?Int32Array:void 0,$i=function(){throw new Error("not implemented")},Hi=Gi()?Xi:$i,Wi=y,qi="function"==typeof Uint32Array;var Ji="function"==typeof Uint32Array?Uint32Array:null,Zi=function(t){return qi&&t instanceof Uint32Array||"[object Uint32Array]"===Wi(t)},Ki=Ji;var Qi=function(){var t,r;if("function"!=typeof Ki)return!1;try{r=new Ki(r=[1,3.14,-3.14,4294967296,4294967297]),t=Zi(r)&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var tu="function"==typeof Uint32Array?Uint32Array:void 0,ru=function(){throw new Error("not implemented")},nu=Qi()?tu:ru,eu=y,ou="function"==typeof Float32Array;var iu="function"==typeof Float32Array?Float32Array:null,uu=function(t){return ou&&t instanceof Float32Array||"[object Float32Array]"===eu(t)},fu=Ar,au=iu;var cu=function(){var t,r;if("function"!=typeof au)return!1;try{r=new au([1,3.14,-3.14,5e40]),t=uu(r)&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===fu}catch(r){t=!1}return t};var su="function"==typeof Float32Array?Float32Array:void 0,lu=function(){throw new Error("not implemented")},hu=cu()?su:lu,pu=y,yu="function"==typeof Float64Array;var vu="function"==typeof Float64Array?Float64Array:null,gu=function(t){return yu&&t instanceof Float64Array||"[object Float64Array]"===pu(t)},wu=vu;var du=function(){var t,r;if("function"!=typeof wu)return!1;try{r=new wu([1,3.14,-3.14,NaN]),t=gu(r)&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t};var bu,mu="function"==typeof Float64Array?Float64Array:void 0,Au=function(){throw new Error("not implemented")};bu=du()?mu:Au;var Eu=ni,_u=li,Ou=mi,Pu=Ui,ju=Fi,Ru=Hi,Tu=nu,Uu=hu,Iu=bu;function Su(t){return new Eu(t)}function Bu(t){return new _u(t)}function Yu(t){return new Ou(t)}function xu(t){return new Pu(t)}function Cu(t){return new ju(t)}function Mu(t){return new Ru(t)}function Lu(t){return new Tu(t)}function Fu(t){return new Uu(t)}function Du(t){return new Iu(t)}var Nu=f,ku=Ct,Vu=Nt,zu=cn,Gu=qt,Xu=yn,$u=xn,Hu=Ye,Wu=Le,qu=ke,Ju=un,Zu=C,Ku=Qo,Qu={int8array:Su,uint8array:Bu,uint8clampedarray:Yu,int16array:xu,uint16array:Cu,int32array:Mu,uint32array:Lu,float32array:Fu,float64array:Du};function tf(t,r,n,e,o){var i,u,f,a,c,s,l,h,p,y;if(o-=1,"object"!=typeof t||null===t)return t;if(Vu(t))return Ku(t);if(zu(t))return function(t){var r,n,e,o,i,u,f=[],a=[];for(i=new t.constructor(t.message),f.push(t),a.push(i),t.stack&&(i.stack=t.stack),t.code&&(i.code=t.code),t.errno&&(i.errno=t.errno),t.syscall&&(i.syscall=t.syscall),r=Hu(t),u=0;u0)for(i=f,y=0;y1){if(!nf(r))throw new TypeError("invalid argument. `level` must be a nonnegative integer. Value: `"+r+"`.");if(0===r)return t}else r=ef;return n=rf(t)?new Array(t.length):{},of(t,n,[t],[n],r)},ff=uf,af=Ct;var cf=function(t){return"object"==typeof t&&null!==t&&!af(t)},sf=Zt,lf=un,hf=f,pf=y,yf=Object.prototype;var vf=function(t){var r;return!!cf(t)&&(!(r=lf(t))||!hf(t,"constructor")&&hf(r,"constructor")&&sf(r.constructor)&&"[object Function]"===pf(r.constructor)&&hf(r,"isPrototypeOf")&&sf(r.isPrototypeOf)&&(r===yf||function(t){var r;for(r in t)if(!hf(t,r))return!1;return!0}(t)))},gf=vf,wf=f,df=J.isPrimitive;var bf={url:"https://stdlib.io/docs/api/latest/error-decoder.html",message:"Minified stdlib error code: {{code}}. Visit {{url}} for the full message."},mf=ur,Af=ff,Ef=function(t,r){return gf(r)?wf(r,"url")&&(t.url=r.url,!df(t.url))?new TypeError("invalid option. `url` option must be a string primitive. Option: `"+t.url+"`."):wf(r,"message")&&(t.message=r.message,!df(t.message))?new TypeError("invalid option. `message` option must be a string primitive. Option: `"+t.message+"`."):null:new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.")},_f=bf;var Of=function(t){var r,n;if(r=Af(_f),n=Ef(r,t))throw n;return function(){var t,n,e=arguments[0],o=r.url+"?code="+e;for(n=1;n\n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasSymbols = require( '@stdlib/assert-has-symbol-support' );\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `toStringTag` support.\n*\n* @module @stdlib/assert-has-tostringtag-support\n*\n* @example\n* var hasToStringTagSupport = require( '@stdlib/assert-has-tostringtag-support' );\n*\n* var bool = hasToStringTagSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasToStringTagSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nmodule.exports = toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object has a specified property.\n*\n* @module @stdlib/assert-has-own-property\n*\n* @example\n* var hasOwnProp = require( '@stdlib/assert-has-own-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* bool = hasOwnProp( beep, 'bop' );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasOwnProp = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nmodule.exports = toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar toStringTag = require( './tostringtag.js' );\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* var nativeClass = require( '@stdlib/utils-native-class' );\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar builtin = require( './native_class.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt8Array = require( '@stdlib/assert-is-int8array' );\nvar INT8_MAX = require( '@stdlib/constants-int8-max' );\nvar INT8_MIN = require( '@stdlib/constants-int8-min' );\nvar GlobalInt8Array = require( './int8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* var INT8_MIN = require( '@stdlib/constants-int8-min' );\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int8Array` support.\n*\n* @module @stdlib/assert-has-int8array-support\n*\n* @example\n* var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\n*\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MODULES //\n\nvar defineProperty = require( './define_property.js' );\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nvar main = ( typeof Object.defineProperty === 'function' ) ? Object.defineProperty : null;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 no-underscore-dangle, no-proto */\n\n'use strict';\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an object. Value: `' + obj + '`.' );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. Property descriptor must be an object. Value: `' + descriptor + '`.' );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* var defineProperty = require( '@stdlib/utils-define-property' );\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nvar hasDefinePropertySupport = require( './has_define_property_support.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar defineProperty = require( '@stdlib/utils-define-property' );\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define a non-enumerable read-only property.\n*\n* @module @stdlib/utils-define-nonenumerable-read-only-property\n*\n* @example\n* var setNonEnumerableReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\n\n// MODULES //\n\nvar setNonEnumerableReadOnly = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar valueOf = require( './valueof.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2valueof.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' );\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isObject;\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isString = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isString, 'isPrimitive', isPrimitive );\nsetReadOnly( isString, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string primitive\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Escape a regular expression string or pattern.\n*\n* @module @stdlib/utils-escape-regexp-string\n*\n* @example\n* var rescape = require( '@stdlib/utils-escape-regexp-string' );\n*\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\n\n// MODULES //\n\nvar rescape = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar RE = /./;\n\n\n// EXPORTS //\n\nmodule.exports = RE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* var isBoolean = require( '@stdlib/assert-is-boolean' );\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* // Use interface to check for boolean primitives...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* // Use interface to check for boolean objects...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isObject;\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isBoolean = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isBoolean, 'isPrimitive', isPrimitive );\nsetReadOnly( isBoolean, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof global === 'object' ) ? global : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar getThis = require( './codegen.js' );\nvar Self = require( './self.js' );\nvar Win = require( './window.js' );\nvar Global = require( './global.js' );\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. Must provide a boolean primitive. Value: `'+codegen+'`.' );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: Node.js\n\tif ( Global ) {\n\t\treturn Global;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getGlobal = require( '@stdlib/utils-global' );\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nmodule.exports = nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the global object.\n*\n* @module @stdlib/utils-global\n*\n* @example\n* var getGlobal = require( '@stdlib/utils-global' );\n*\n* var g = getGlobal();\n* // returns {...}\n*/\n\n// MODULES //\n\nvar getGlobal = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar RE = require( './fixtures/re.js' );\nvar nodeList = require( './fixtures/nodelist.js' );\nvar typedarray = require( './fixtures/typedarray.js' );\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* var reFunctionName = require( '@stdlib/regexp-function-name' );\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reFunctionName = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reFunctionName, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar reFunctionName = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nmodule.exports = RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nmodule.exports = f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an array.\n*\n* @module @stdlib/assert-is-array\n*\n* @example\n* var isArray = require( '@stdlib/assert-is-array' );\n*\n* var bool = isArray( [] );\n* // returns true\n*\n* bool = isArray( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isArray = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* var isOdd = require( '@stdlib/assert-is-odd' );\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a function. Value: `' + predicate + '`.' );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' );\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' ).isObjectLikeArray;\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar arrayfun = require( '@stdlib/assert-tools-array-function' );\nvar isObjectLike = require( './main.js' );\n\n\n// MAIN //\n\nsetReadOnly( isObjectLike, 'isObjectLikeArray', arrayfun( isObjectLike ) );\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObjectLike = require( '@stdlib/assert-is-object-like' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a Buffer instance.\n*\n* @module @stdlib/assert-is-buffer\n*\n* @example\n* var isBuffer = require( '@stdlib/assert-is-buffer' );\n*\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* v = isBuffer( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isBuffer = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar RE = require( '@stdlib/regexp-function-name' ).REGEXP;\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine the name of a value's constructor.\n*\n* @module @stdlib/utils-constructor-name\n*\n* @example\n* var constructorName = require( '@stdlib/utils-constructor-name' );\n*\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* v = constructorName( {} );\n* // returns 'Object'\n*\n* v = constructorName( true );\n* // returns 'Boolean'\n*/\n\n// MODULES //\n\nvar constructorName = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* var typeOf = require( '@stdlib/utils-type-of' );\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nvar usePolyfill = require( './check.js' );\nvar typeOf = require( './typeof.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : typeOf;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar typeOf = require( '@stdlib/utils-type-of' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a function.\n*\n* @module @stdlib/assert-is-function\n*\n* @example\n* var isFunction = require( '@stdlib/assert-is-function' );\n*\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\n\n// MODULES //\n\nvar isFunction = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar exec = require( './exec.js' );\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2exec.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar rescape = require( '@stdlib/utils-escape-regexp-string' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isRegExp = require( '@stdlib/assert-is-regexp' );\n\n\n// MAIN //\n\n/**\n* Replace search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string primitive\n* @throws {TypeError} second argument argument must be a string primitive or regular expression\n* @throws {TypeError} third argument must be a string primitive or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* var capitalize = require( '@stdlib/string-capitalize' );\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer);\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be a string primitive. Value: `' + str + '`.' );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = rescape( search );\n\t\tsearch = new RegExp( search, 'g' );\n\t}\n\telse if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( 'invalid argument. Second argument must be a string primitive or regular expression. Value: `' + search + '`.' );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( 'invalid argument. Third argument must be a string primitive or replacement function. Value: `' + newval + '`.' );\n\t}\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Replace search occurrences with a replacement string.\n*\n* @module @stdlib/string-replace\n*\n* @example\n* var replace = require( '@stdlib/string-replace' );\n*\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* str = 'Hello World';\n* out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*/\n\n// MODULES //\n\nvar replace = require( './replace.js' );\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Constructor which returns a `Number` object.\n*\n* @module @stdlib/number-ctor\n*\n* @example\n* var Number = require( '@stdlib/number-ctor' );\n*\n* var v = new Number( 10.0 );\n* // returns \n*/\n\n// MODULES //\n\nvar Number = require( './number.js' );\n\n\n// EXPORTS //\n\nmodule.exports = Number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// EXPORTS //\n\nmodule.exports = Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar Number = require( '@stdlib/number-ctor' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' );\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isObject;\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNumber = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNumber, 'isPrimitive', isPrimitive );\nsetReadOnly( isNumber, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* var FLOAT64_PINF = require( '@stdlib/constants-float64-pinf' );\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* var FLOAT64_NINF = require( '@stdlib/constants-float64-ninf' );\n* // returns -Infinity\n*/\n\n// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar floor = require( '@stdlib/math-base-special-floor' );\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nmodule.exports = floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a finite double-precision floating-point number is an integer.\n*\n* @module @stdlib/math-base-assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/math-base-assert-is-integer' );\n*\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* bool = isInteger( 3.14 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isInteger = require( './is_integer.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar isInt = require( '@stdlib/math-base-assert-is-integer' );\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/assert-is-integer' );\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' );\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isObject;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNonNegativeInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNonNegativeInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isNonNegativeInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar getProto = require( './proto.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar builtin = require( './native.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getProto = require( './detect.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the prototype of a provided object.\n*\n* @module @stdlib/utils-get-prototype-of\n*\n* @example\n* var getPrototype = require( '@stdlib/utils-get-prototype-of' );\n*\n* var proto = getPrototype( {} );\n* // returns {}\n*/\n\n// MODULES //\n\nvar getPrototype = require( './get_prototype_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an `Error` object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `Error` object\n*\n* @example\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isError( {} );\n* // returns false\n*/\nfunction isError( value ) {\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tif ( value instanceof Error ) {\n\t\treturn true;\n\t}\n\t// Walk the prototype tree until we find an object having the desired native class...\n\twhile ( value ) {\n\t\tif ( nativeClass( value ) === '[object Error]' ) {\n\t\t\treturn true;\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `Error` object.\n*\n* @module @stdlib/assert-is-error\n*\n* @example\n* var isError = require( '@stdlib/assert-is-error' );\n*\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* bool = isError( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isError = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 a regular expression to parse a regular expression string.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*/\nfunction reRegExp() {\n\treturn /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/; // eslint-disable-line no-useless-escape\n}\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 regular expression to parse a regular expression string.\n*\n* @module @stdlib/regexp-regexp\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var parts = RE_REGEXP.exec( '/^.*$/ig' );\n* // returns [ '/^.*$/ig', '^.*$', 'ig', 'index': 0, 'input': '/^.*$/ig' ]\n*/\n\n// MAIN //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reRegExp = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reRegExp, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar reRegExp = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Matches parts of a regular expression string.\n*\n* Regular expression: `/^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/`\n*\n* - `/^\\/`\n* - match a string that begins with a `/`\n*\n* - `()`\n* - capture\n*\n* - `(?:)+`\n* - capture, but do not remember, a group of characters which occur one or more times\n*\n* - `\\\\\\/`\n* - match the literal `\\/`\n*\n* - `|`\n* - OR\n*\n* - `[^\\/]`\n* - anything which is not the literal `\\/`\n*\n* - `\\/`\n* - match the literal `/`\n*\n* - `([imgy]*)`\n* - capture any characters matching `imgy` occurring zero or more times\n*\n* - `$/`\n* - string end\n*\n*\n* @constant\n* @type {RegExp}\n* @default /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/\n*/\nvar RE_REGEXP = reRegExp();\n\n\n// EXPORTS //\n\nmodule.exports = RE_REGEXP;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar reRegExp = require( '@stdlib/regexp-regexp' );\n\n\n// MAIN //\n\n/**\n* Parses a regular expression string and returns a new regular expression.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} must provide a regular expression string\n* @returns {(RegExp|null)} regular expression or null\n*\n* @example\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\nfunction reFromString( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Capture the regular expression pattern and any flags:\n\tstr = reRegExp().exec( str );\n\n\t// Create a new regular expression:\n\treturn ( str ) ? new RegExp( str[1], str[2] ) : null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Create a regular expression from a regular expression string.\n*\n* @module @stdlib/utils-regexp-from-string\n*\n* @example\n* var reFromString = require( '@stdlib/utils-regexp-from-string' );\n*\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\n\n// MODULES //\n\nvar reFromString = require( './from_string.js' );\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a double-precision floating-point numeric value is `NaN`.\n*\n* @module @stdlib/math-base-assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/math-base-assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 7.0 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isnan = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is `NaN`.\n*\n* @module @stdlib/assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isObject;\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isnan = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isnan, 'isPrimitive', isPrimitive );\nsetReadOnly( isnan, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isCollection;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isnan = require( '@stdlib/assert-is-nan' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} `fromIndex` must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array-like object. Value: `' + arr + '`.' );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `fromIndex` must be an integer. Value: `' + fromIndex + '`.' );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* var MAX_TYPED_ARRAY_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nmodule.exports = MAX_TYPED_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the first index at which a given element can be found.\n*\n* @module @stdlib/utils-index-of\n*\n* @example\n* var indexOf = require( '@stdlib/utils-index-of' );\n*\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* arr = [ 4, 3, 2, 1 ];\n* idx = indexOf( arr, 5 );\n* // returns -1\n*\n* // Using a `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* // `fromIndex` which exceeds `array` length:\n* arr = [ 1, 2, 3, 4, 2, 5 ];\n* idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* // Negative `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* // Negative `fromIndex` exceeding input `array` length:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* // Array-like objects:\n* var str = 'bebop';\n* idx = indexOf( str, 'o' );\n* // returns 3\n*/\n\n// MODULES //\n\nvar indexOf = require( './index_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar keys = require( './builtin.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.keys !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArguments = require( './main.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnum = require( './native.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' );\nvar isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isEnum = require( './native.js' );\nvar hasStringEnumBug = require( './has_string_enumerability_bug.js' );\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object's own property is enumerable.\n*\n* @module @stdlib/assert-is-enumerable-property\n*\n* @example\n* var isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\n\n// MODULES //\n\nvar isEnumerableProperty = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-uint32-max' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* var isArguments = require( '@stdlib/assert-is-arguments' );\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasArgumentsClass = require( './detect.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar builtin = require( './builtin.js' );\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nmodule.exports = noop;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar noop = require( '@stdlib/utils-noop' );\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isConstructorPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar EXCLUDED_KEYS = require( './excluded_keys.json' );\nvar win = require( './window.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nmodule.exports = w;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof window !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasAutomationEqualityBug = require( './has_automation_equality_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar HAS_WINDOW = require( './has_window.js' );\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = wrapper;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObjectLike = require( '@stdlib/assert-is-object-like' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar HAS_ENUM_PROTO_BUG = require( './has_enumerable_prototype_bug.js' );\nvar HAS_NON_ENUM_PROPS_BUG = require( './has_non_enumerable_properties_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype_wrapper.js' );\nvar NON_ENUMERABLE = require( './non_enumerable.json' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasArgumentsBug = require( './has_arguments_bug.js' );\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar wrapper = require( './builtin_wrapper.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an array of an object's own enumerable property names.\n*\n* @module @stdlib/utils-keys\n*\n* @example\n* var keys = require( '@stdlib/utils-keys' );\n*\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\n\n// MODULES //\n\nvar keys = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.getOwnPropertyNames !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyNames = Object.getOwnPropertyNames;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn propertyNames( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar keys = require( '@stdlib/utils-keys' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n* - In environments lacking support for `Object.getOwnPropertyNames()`, property descriptors are unavailable, and thus all properties can be safely assumed to be enumerable. Hence, we can defer to calling `Object.keys`, which retrieves all own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an array of an object's own enumerable and non-enumerable property names.\n*\n* @module @stdlib/utils-property-names\n*\n* @example\n* var getOwnPropertyNames = require( '@stdlib/utils-property-names' );\n*\n* var keys = getOwnPropertyNames({\n* 'foo': 'bar',\n* 'beep': 'boop'\n* });\n* // e.g., returns [ 'foo', 'beep' ]\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.getOwnPropertyDescriptor !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyDescriptor = Object.getOwnPropertyDescriptor;\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tvar desc;\n\tif ( value === null || value === void 0 ) {\n\t\treturn null;\n\t}\n\tdesc = propertyDescriptor( value, property );\n\treturn ( desc === void 0 ) ? null : desc;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n* - In environments lacking `Object.getOwnPropertyDescriptor()` support, property descriptors do not exist. In non-supporting environment, if an object has a provided property, this function returns a descriptor object equivalent to that returned in a supporting environment; otherwise, the function returns `null`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tif ( hasOwnProp( value, property ) ) {\n\t\treturn {\n\t\t\t'configurable': true,\n\t\t\t'enumerable': true,\n\t\t\t'writable': true,\n\t\t\t'value': value[ property ]\n\t\t};\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 property descriptor for an object's own property.\n*\n* @module @stdlib/utils-property-descriptor\n*\n* @example\n* var getOwnPropertyDescriptor = require( '@stdlib/utils-property-descriptor' );\n*\n* var obj = {\n* 'foo': 'bar',\n* 'beep': 'boop'\n* };\n*\n* var keys = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':'bar'}\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write (browser) polyfill\n\n// MAIN //\n\n/**\n* Buffer constructor.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Buffer constructor.\n*\n* @module @stdlib/buffer-ctor\n*\n* @example\n* var ctor = require( '@stdlib/buffer-ctor' );\n*\n* var b = new ctor( [ 1, 2, 3, 4 ] );\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\nvar main = require( './buffer.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasNodeBufferSupport() ) {\n\tctor = main;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = require( 'buffer' ).Buffer; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn Buffer.from( buffer );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn new Buffer( buffer ); // eslint-disable-line no-buffer-constructor\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy buffer data to a new `Buffer` instance.\n*\n* @module @stdlib/buffer-from-buffer\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n* var copyBuffer = require( '@stdlib/buffer-from-buffer' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = copyBuffer( b1 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFrom = require( './has_from.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar copyBuffer;\nif ( hasFrom ) {\n\tcopyBuffer = main;\n} else {\n\tcopyBuffer = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = copyBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './int8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint8Array = require( '@stdlib/assert-is-uint8array' );\nvar UINT8_MAX = require( '@stdlib/constants-uint8-max' );\nvar GlobalUint8Array = require( './uint8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\nvar builtin = require( './uint8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8Array` support.\n*\n* @module @stdlib/assert-has-uint8array-support\n*\n* @example\n* var hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\n*\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8ClampedArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint8ClampedArray = require( '@stdlib/assert-is-uint8clampedarray' );\nvar GlobalUint8ClampedArray = require( './uint8clampedarray.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @module @stdlib/array-uint8c\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8c' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' ); // eslint-disable-line id-length\nvar builtin = require( './uint8clampedarray.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8ClampedArray` support.\n*\n* @module @stdlib/assert-has-uint8clampedarray-support\n*\n* @example\n* var hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' );\n*\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt16Array = require( '@stdlib/assert-is-int16array' );\nvar INT16_MAX = require( '@stdlib/constants-int16-max' );\nvar INT16_MIN = require( '@stdlib/constants-int16-min' );\nvar GlobalInt16Array = require( './int16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-min\n* @type {integer32}\n*\n* @example\n* var INT16_MIN = require( '@stdlib/constants-int16-min' );\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT16_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int16\n*\n* @example\n* var ctor = require( '@stdlib/array-int16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\nvar builtin = require( './int16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int16Array === 'function' ) ? Int16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int16Array` support.\n*\n* @module @stdlib/assert-has-int16array-support\n*\n* @example\n* var hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\n*\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint16Array = require( '@stdlib/assert-is-uint16array' );\nvar UINT16_MAX = require( '@stdlib/constants-uint16-max' );\nvar GlobalUint16Array = require( './uint16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 16-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint16\n*\n* @example\n* var ctor = require( '@stdlib/array-uint16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\nvar builtin = require( './uint16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint16Array === 'function' ) ? Uint16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint16Array` support.\n*\n* @module @stdlib/assert-has-uint16array-support\n*\n* @example\n* var hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\n*\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt32Array = require( '@stdlib/assert-is-int32array' );\nvar INT32_MAX = require( '@stdlib/constants-int32-max' );\nvar INT32_MIN = require( '@stdlib/constants-int32-min' );\nvar GlobalInt32Array = require( './int32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-min\n* @type {integer32}\n*\n* @example\n* var INT32_MIN = require( '@stdlib/constants-int32-min' );\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT32_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int32\n*\n* @example\n* var ctor = require( '@stdlib/array-int32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\nvar builtin = require( './int32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int32Array === 'function' ) ? Int32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int32Array` support.\n*\n* @module @stdlib/assert-has-int32array-support\n*\n* @example\n* var hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\n*\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint32Array = require( '@stdlib/assert-is-uint32array' );\nvar UINT32_MAX = require( '@stdlib/constants-uint32-max' );\nvar GlobalUint32Array = require( './uint32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 32-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint32\n*\n* @example\n* var ctor = require( '@stdlib/array-uint32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\nvar builtin = require( './uint32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint32Array === 'function' ) ? Uint32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint32Array` support.\n*\n* @module @stdlib/assert-has-uint32array-support\n*\n* @example\n* var hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\n*\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFloat32Array = require( '@stdlib/assert-is-float32array' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar GlobalFloat32Array = require( './float32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of single-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float32\n*\n* @example\n* var ctor = require( '@stdlib/array-float32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\nvar builtin = require( './float32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Float32Array === 'function' ) ? Float32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float32Array` support.\n*\n* @module @stdlib/assert-has-float32array-support\n*\n* @example\n* var hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\n*\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat64Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFloat64Array = require( '@stdlib/assert-is-float64array' );\nvar GlobalFloat64Array = require( './float64array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float64\n*\n* @example\n* var ctor = require( '@stdlib/array-float64' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\nvar builtin = require( './float64array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Float64Array === 'function' ) ? Float64Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float64Array` support.\n*\n* @module @stdlib/assert-has-float64array-support\n*\n* @example\n* var hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\n*\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Int8Array = require( '@stdlib/array-int8' );\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar Uint8ClampedArray = require( '@stdlib/array-uint8c' );\nvar Int16Array = require( '@stdlib/array-int16' );\nvar Uint16Array = require( '@stdlib/array-uint16' );\nvar Int32Array = require( '@stdlib/array-int32' );\nvar Uint32Array = require( '@stdlib/array-uint32' );\nvar Float32Array = require( '@stdlib/array-float32' );\nvar Float64Array = require( '@stdlib/array-float64' );\n\n\n// VARIABLES //\n\nvar hash;\n\n\n// FUNCTIONS //\n\n/**\n* Copies an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - array to copy\n* @returns {Int8Array} new array\n*/\nfunction int8array( arr ) {\n\treturn new Int8Array( arr );\n}\n\n/**\n* Copies a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - array to copy\n* @returns {Uint8Array} new array\n*/\nfunction uint8array( arr ) {\n\treturn new Uint8Array( arr );\n}\n\n/**\n* Copies a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - array to copy\n* @returns {Uint8ClampedArray} new array\n*/\nfunction uint8clampedarray( arr ) {\n\treturn new Uint8ClampedArray( arr );\n}\n\n/**\n* Copies an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - array to copy\n* @returns {Int16Array} new array\n*/\nfunction int16array( arr ) {\n\treturn new Int16Array( arr );\n}\n\n/**\n* Copies a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - array to copy\n* @returns {Uint16Array} new array\n*/\nfunction uint16array( arr ) {\n\treturn new Uint16Array( arr );\n}\n\n/**\n* Copies an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - array to copy\n* @returns {Int32Array} new array\n*/\nfunction int32array( arr ) {\n\treturn new Int32Array( arr );\n}\n\n/**\n* Copies a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - array to copy\n* @returns {Uint32Array} new array\n*/\nfunction uint32array( arr ) {\n\treturn new Uint32Array( arr );\n}\n\n/**\n* Copies a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - array to copy\n* @returns {Float32Array} new array\n*/\nfunction float32array( arr ) {\n\treturn new Float32Array( arr );\n}\n\n/**\n* Copies a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - array to copy\n* @returns {Float64Array} new array\n*/\nfunction float64array( arr ) {\n\treturn new Float64Array( arr );\n}\n\n/**\n* Returns a hash of functions for copying typed arrays.\n*\n* @private\n* @returns {Object} function hash\n*/\nfunction typedarrays() {\n\tvar out = {\n\t\t'int8array': int8array,\n\t\t'uint8array': uint8array,\n\t\t'uint8clampedarray': uint8clampedarray,\n\t\t'int16array': int16array,\n\t\t'uint16array': uint16array,\n\t\t'int32array': int32array,\n\t\t'uint32array': uint32array,\n\t\t'float32array': float32array,\n\t\t'float64array': float64array\n\t};\n\treturn out;\n}\n\n\n// MAIN //\n\nhash = typedarrays();\n\n\n// EXPORTS //\n\nmodule.exports = hash;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar regexp = require( '@stdlib/utils-regexp-from-string' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar propertyNames = require( '@stdlib/utils-property-names' );\nvar propertyDescriptor = require( '@stdlib/utils-property-descriptor' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar defineProperty = require( '@stdlib/utils-define-property' );\nvar copyBuffer = require( '@stdlib/buffer-from-buffer' );\nvar typedArrays = require( './typed_arrays.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Clones a class instance.\n*\n* ## Notes\n*\n* - This should **only** be used for simple cases. Any instances with privileged access to variables (e.g., within closures) cannot be cloned. This approach should be considered **fragile**.\n* - The function is greedy, disregarding the notion of a `level`. Instead, the function deep copies all properties, as we assume the concept of `level` applies only to the class instance reference but not to its internal state. This prevents, in theory, two instances from sharing state.\n*\n*\n* @private\n* @param {Object} val - class instance\n* @returns {Object} new instance\n*/\nfunction cloneInstance( val ) {\n\tvar cache;\n\tvar names;\n\tvar name;\n\tvar refs;\n\tvar desc;\n\tvar tmp;\n\tvar ref;\n\tvar i;\n\n\tcache = [];\n\trefs = [];\n\n\tref = Object.create( getPrototypeOf( val ) );\n\tcache.push( val );\n\trefs.push( ref );\n\n\tnames = propertyNames( val );\n\tfor ( i = 0; i < names.length; i++ ) {\n\t\tname = names[ i ];\n\t\tdesc = propertyDescriptor( val, name );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( val[name] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( val[name], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( ref, name, desc );\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( ref );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( ref );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( ref );\n\t}\n\treturn ref;\n}\n\n/**\n* Copies an error object.\n*\n* @private\n* @param {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error - error to copy\n* @returns {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error copy\n*\n* @example\n* var err1 = new TypeError( 'beep' );\n*\n* var err2 = copyError( err1 );\n* // returns \n*/\nfunction copyError( error ) {\n\tvar cache = [];\n\tvar refs = [];\n\tvar keys;\n\tvar desc;\n\tvar tmp;\n\tvar key;\n\tvar err;\n\tvar i;\n\n\t// Create a new error...\n\terr = new error.constructor( error.message );\n\n\tcache.push( error );\n\trefs.push( err );\n\n\t// If a `stack` property is present, copy it over...\n\tif ( error.stack ) {\n\t\terr.stack = error.stack;\n\t}\n\t// Node.js specific (system errors)...\n\tif ( error.code ) {\n\t\terr.code = error.code;\n\t}\n\tif ( error.errno ) {\n\t\terr.errno = error.errno;\n\t}\n\tif ( error.syscall ) {\n\t\terr.syscall = error.syscall;\n\t}\n\t// Any enumerable properties...\n\tkeys = objectKeys( error );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tdesc = propertyDescriptor( error, key );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( error[ key ] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( error[ key ], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( err, key, desc );\n\t}\n\treturn err;\n}\n\n\n// MAIN //\n\n/**\n* Recursively performs a deep copy of an input object.\n*\n* @private\n* @param {*} val - value to copy\n* @param {(Array|Object)} copy - copy\n* @param {Array} cache - an array of visited objects\n* @param {Array} refs - an array of object references\n* @param {NonNegativeInteger} level - copy depth\n* @returns {*} deep copy\n*/\nfunction deepCopy( val, copy, cache, refs, level ) {\n\tvar parent;\n\tvar keys;\n\tvar name;\n\tvar desc;\n\tvar ctor;\n\tvar key;\n\tvar ref;\n\tvar x;\n\tvar i;\n\tvar j;\n\n\tlevel -= 1;\n\n\t// Primitives and functions...\n\tif (\n\t\ttypeof val !== 'object' ||\n\t\tval === null\n\t) {\n\t\treturn val;\n\t}\n\tif ( isBuffer( val ) ) {\n\t\treturn copyBuffer( val );\n\t}\n\tif ( isError( val ) ) {\n\t\treturn copyError( val );\n\t}\n\t// Objects...\n\tname = typeOf( val );\n\n\tif ( name === 'date' ) {\n\t\treturn new Date( +val );\n\t}\n\tif ( name === 'regexp' ) {\n\t\treturn regexp( val.toString() );\n\t}\n\tif ( name === 'set' ) {\n\t\treturn new Set( val );\n\t}\n\tif ( name === 'map' ) {\n\t\treturn new Map( val );\n\t}\n\tif (\n\t\tname === 'string' ||\n\t\tname === 'boolean' ||\n\t\tname === 'number'\n\t) {\n\t\t// If provided an `Object`, return an equivalent primitive!\n\t\treturn val.valueOf();\n\t}\n\tctor = typedArrays[ name ];\n\tif ( ctor ) {\n\t\treturn ctor( val );\n\t}\n\t// Class instances...\n\tif (\n\t\tname !== 'array' &&\n\t\tname !== 'object'\n\t) {\n\t\t// Cloning requires ES5 or higher...\n\t\tif ( typeof Object.freeze === 'function' ) {\n\t\t\treturn cloneInstance( val );\n\t\t}\n\t\treturn {};\n\t}\n\t// Arrays and plain objects...\n\tkeys = objectKeys( val );\n\tif ( level > 0 ) {\n\t\tparent = name;\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tx = val[ key ];\n\n\t\t\t// Primitive, Buffer, special class instance...\n\t\t\tname = typeOf( x );\n\t\t\tif (\n\t\t\t\ttypeof x !== 'object' ||\n\t\t\t\tx === null ||\n\t\t\t\t(\n\t\t\t\t\tname !== 'array' &&\n\t\t\t\t\tname !== 'object'\n\t\t\t\t) ||\n\t\t\t\tisBuffer( x )\n\t\t\t) {\n\t\t\t\tif ( parent === 'object' ) {\n\t\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\t\tdesc.value = deepCopy( x );\n\t\t\t\t\t}\n\t\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t\t} else {\n\t\t\t\t\tcopy[ key ] = deepCopy( x );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Circular reference...\n\t\t\ti = indexOf( cache, x );\n\t\t\tif ( i !== -1 ) {\n\t\t\t\tcopy[ key ] = refs[ i ];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Plain array or object...\n\t\t\tref = ( isArray( x ) ) ? new Array( x.length ) : {};\n\t\t\tcache.push( x );\n\t\t\trefs.push( ref );\n\t\t\tif ( parent === 'array' ) {\n\t\t\t\tcopy[ key ] = deepCopy( x, ref, cache, refs, level );\n\t\t\t} else {\n\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\tdesc.value = deepCopy( x, ref, cache, refs, level );\n\t\t\t\t}\n\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t}\n\t\t}\n\t} else if ( name === 'array' ) {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tcopy[ key ] = val[ key ];\n\t\t}\n\t} else {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\tdefineProperty( copy, key, desc );\n\t\t}\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( copy );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( copy );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( copy );\n\t}\n\treturn copy;\n}\n\n\n// EXPORTS //\n\nmodule.exports = deepCopy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar deepCopy = require( './deep_copy.js' );\n\n\n// MAIN //\n\n/**\n* Copies or deep clones a value to an arbitrary depth.\n*\n* @param {*} value - value to copy\n* @param {NonNegativeInteger} [level=+infinity] - copy depth\n* @throws {TypeError} `level` must be a nonnegative integer\n* @returns {*} value copy\n*\n* @example\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ { 'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\nfunction copy( value, level ) {\n\tvar out;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( level ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `level` must be a nonnegative integer. Value: `' + level + '`.' );\n\t\t}\n\t\tif ( level === 0 ) {\n\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tlevel = PINF;\n\t}\n\tout = ( isArray( value ) ) ? new Array( value.length ) : {};\n\treturn deepCopy( value, out, [value], [out], level );\n}\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy or deep clone a value to an arbitrary depth.\n*\n* @module @stdlib/utils-copy\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ {'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\n\n// MODULES //\n\nvar copy = require( './copy.js' );\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {(Error|null)} error object or null\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );\n\t}\n\tif ( hasOwnProp( options, 'url' ) ) {\n\t\topts.url = options.url;\n\t\tif ( !isString( opts.url ) ) {\n\t\t\treturn new TypeError( 'invalid option. `url` option must be a string primitive. Option: `' + opts.url + '`.' );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'message' ) ) {\n\t\topts.message = options.message;\n\t\tif ( !isString( opts.message ) ) {\n\t\t\treturn new TypeError( 'invalid option. `message` option must be a string primitive. Option: `' + opts.message + '`.' );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a plain object.\n*\n* @module @stdlib/assert-is-plain-object\n*\n* @example\n* var isPlainObject = require( '@stdlib/assert-is-plain-object' );\n*\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* bool = isPlainObject( null );\n* // returns false\n*/\n\n// MODULES //\n\nvar isPlainObject = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar replace = require( '@stdlib/string-replace' );\nvar copy = require( '@stdlib/utils-copy' );\nvar validate = require( './validate.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function which formats an error message for production.\n*\n* @param {Options} options - function options\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {Function} error formatting function\n*\n* @example\n* var opts = {\n* 'url': 'https://stdlib.io/error-decoder.html'\n* };\n*\n* var fcn = factory( opts );\n* // returns \n*/\nfunction factory( options ) {\n\tvar opts;\n\tvar err;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\treturn formatProdErrorMessage;\n\n\t/**\n\t* Formats an error message for production.\n\t*\n\t* @private\n\t* @param {string} code - error code\n\t* @param {*} ...args - error message arguments\n\t* @returns {string} formatted error message\n\t*/\n\tfunction formatProdErrorMessage() {\n\t\tvar code = arguments[ 0 ];\n\t\tvar url = opts.url + '?code='+code;\n\t\tvar msg;\n\t\tvar i;\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\turl += '&arg[]=' + encodeURIComponent( arguments[ i ] );\n\t\t}\n\t\tmsg = replace( opts.message, '{{url}}', url );\n\t\tmsg = replace( msg, '{{code}}', code );\n\t\treturn msg;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Format an error message for production.\n*\n* @module @stdlib/error-tools-fmtprodmsg\n*\n* @example\n* var formatProdErrorMessage = require( '@stdlib/error-tools-fmtprodmsg' );\n*\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar formatProdErrorMessage = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( formatProdErrorMessage, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar factory = require( './factory.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @name formatProdErrorMessage\n* @type {Function}\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\nvar formatProdErrorMessage = factory( defaults );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","hasSymbols","lib","toStringTag","tostring","Object","prototype","toString","toStr","require$$0","native_class","v","call","has","hasOwnProperty","value","property","toStrTag","hasOwnProp","require$$2","builtin","require$$1","polyfill","isOwn","tag","out","err","nativeClass","hasInt8Array","Int8Array","main","isInt8Array","GlobalInt8Array","bool","arr","INT8_MAX","ctor","defineProperty","has_define_property_support","objectProtoype","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","obj","prop","descriptor","hasValue","hasGet","hasSet","TypeError","__proto__","Error","get","set","configurable","enumerable","writable","primitive","valueOf","String","test","object","isPrimitive","isObject","setReadOnly","isString","require$$3","RE_CHARS","str","s","i","length","replace","substring","re","Boolean","isBoolean","codegen","Function","self_1","self","window_1","window","global","module","exports","getThis","Self","Win","Global","arguments","root","nodeList","document","childNodes","typedarray","RE","check_1","reFunctionName","Array","isArray","isObjectLike","predicate","len","arrayfun","_isBuffer","constructor","isBuffer","REGEXP","match","name","slice","exec","ctorName","typeOf","type","toLowerCase","RegExp","rescape","isFunction","isRegExp","search","newval","Number","isNumber","POSITIVE_INFINITY","NEGATIVE_INFINITY","floor","Math","x","PINF","NINF","isInt","integer","isInteger","isNonNegativeInteger","getProto","getPrototypeOf","proto","reRegExp","isNan","isnan","isCollection","index_of","searchElement","fromIndex","keys","has_arguments_bug","has_builtin","isArguments","bool$8","detect","detect_1","native","propertyIsEnumerable","bool$7","isEnum","hasStringEnumBug","isEnumerableProperty","require$$4","builtin_wrapper","has_enumerable_prototype_bug","has_non_enumerable_properties_bug","is_constructor_prototype","w","indexOf","isConstructorPrototype","EXCLUDED_KEYS","win","bool$4","k","check","hasAutomationEqualityBug","HAS_WINDOW","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","error","NON_ENUMERABLE","wrapper","skipConstructor","skipPrototype","isFcn","p","push","getOwnPropertyNames","propertyNames","getOwnPropertyDescriptor","propertyDescriptor","desc","Buffer","from","buffer","hasUint8Array","Uint8Array","isUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ClampedArray","Uint8ClampedArray","isUint8ClampedArray","GlobalUint8ClampedArray","hasInt16Array","Int16Array","isInt16Array","GlobalInt16Array","INT16_MAX","hasUint16Array","Uint16Array","isUint16Array","GlobalUint16Array","UINT16_MAX","hasInt32Array","Int32Array","isInt32Array","GlobalInt32Array","INT32_MAX","hasUint32Array","Uint32Array","isUint32Array","GlobalUint32Array","UINT32_MAX","hasFloat32Array","Float32Array","isFloat32Array","GlobalFloat32Array","hasFloat64Array","Float64Array","isFloat64Array","GlobalFloat64Array","NaN","require$$5","require$$6","require$$7","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","isError","regexp","objectKeys","require$$8","require$$9","require$$10","require$$11","copyBuffer","require$$12","typedArrays","deepCopy","val","copy","cache","refs","level","parent","key","ref","j","tmp","message","stack","code","errno","syscall","copyError","Date","Set","Map","freeze","names","create","isExtensible","preventExtensions","isSealed","seal","isFrozen","cloneInstance","copy_1","objectPrototype","isPrototypeOf","ownProps","validate","opts","options","url","defaults","factory_1","msg","encodeURIComponent","formatProdErrorMessage","hasInt8ArraySupport","format"],"mappings":";+kBAyCA,ICdIA,EDIJ,WACC,MACmB,mBAAXC,QACoB,iBAApBA,OAAQ,OCPPC,GAqBV,ICTAC,EDEA,WACC,OAASH,GAAqC,iBAAvBC,OAAOG,aEf/BC,EALYC,OAAOC,UAAUC,SCAzBC,EAAQC,EAiCZ,IAAAC,EAPA,SAAsBC,GACrB,OAAOH,EAAMI,KAAMD,IC3BhBE,EAAMR,OAAOC,UAAUQ,eAyC3B,ICjBAZ,EDIA,SAAqBa,EAAOC,GAC3B,OACCD,SAKMF,EAAID,KAAMG,EAAOC,IEnCrBC,EAA+B,mBAAXjB,OAA0BA,OAAOG,YAAc,GCAnEe,EAAaT,EACbN,EDIac,ECHbT,EAAQW,EAwDZ,ICpCIC,EAAUC,EACVC,EDKJ,SAAsBX,GACrB,IAAIY,EACAC,EACAC,EAEJ,GAAKd,QACJ,OAAOH,EAAMI,KAAMD,GAEpBa,EAAMb,EAAGR,GACToB,EAAQL,EAAYP,EAAGR,GAGvB,IACCQ,EAAGR,QAAgB,EAClB,MAAQuB,GACT,OAAOlB,EAAMI,KAAMD,GASpB,OAPAc,EAAMjB,EAAMI,KAAMD,GAEbY,EACJZ,EAAGR,GAAgBqB,SAEZb,EAAGR,GAEJsB,GCdRvB,EAjBqBO,IASNa,EAEAF,EChCXO,EAAclB,EAKdmB,EAAsC,mBAAdC,UA6B5B,IClCIC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EFwBJ,SAAsBhB,GACrB,OACGa,GAAgBb,aAAiBc,WACV,uBAAzBF,EAAaZ,IExBXiB,EDEaF,ECsCjB,IAAAA,EA1BA,WACC,IAAIG,EACAC,EAEJ,GAAgC,mBAApBF,EACX,OAAO,EAGR,IACCE,EAAM,IAAIF,EAAiB,CAAE,EAAG,MAAO,KAAMG,MAC7CF,EACCF,EAAaG,IACA,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEpBR/B,EAL0BO,ECZtB2B,EAA8B,mBAAdP,UAA6BA,eAAY,ECAzDQ,ECA0C,mBAA1BhC,OAAOgC,eAAkChC,OAAOgC,eAAiB,KD4BrF,IAAAC,EAbA,WAEC,IAEC,OADAD,EAAgB,GAAI,IAAK,KAClB,EACN,MAAQX,GACT,OAAO,IEiBTN,EALqBf,OAAOgC,eC/BxBE,EAAiBlC,OAAOC,UACxBE,EAAQ+B,EAAehC,SACvBiC,EAAeD,EAAeE,iBAC9BC,EAAeH,EAAeI,iBAC9BC,EAAeL,EAAeM,iBAC9BC,EAAeP,EAAeQ,iBAuFlC,IAAAzB,EAnDA,SAAyB0B,EAAKC,EAAMC,GACnC,IAAI5C,EACA6C,EACAC,EACAC,EAEJ,GAAoB,iBAARL,GAA4B,OAARA,GAAsC,mBAAtBxC,EAAMI,KAAMoC,GAC3D,MAAM,IAAIM,UAAW,+DAAiEN,EAAM,MAE7F,GAA2B,iBAAfE,GAA0C,OAAfA,GAAoD,mBAA7B1C,EAAMI,KAAMsC,GACzE,MAAM,IAAII,UAAW,oEAAsEJ,EAAa,MAyBzG,IAvBAC,EAAa,UAAWD,KAGtBN,EAAahC,KAAMoC,EAAKC,IACxBH,EAAalC,KAAMoC,EAAKC,IAGxB3C,EAAY0C,EAAIO,UAChBP,EAAIO,UAAYhB,SAGTS,EAAKC,GACZD,EAAKC,GAASC,EAAWnC,MAGzBiC,EAAIO,UAAYjD,GAEhB0C,EAAKC,GAASC,EAAWnC,OAG3BqC,EAAW,QAASF,EACpBG,EAAW,QAASH,EAEfC,IAAcC,GAAUC,GAC5B,MAAM,IAAIG,MAAO,wHASlB,OANKJ,GAAUZ,GACdA,EAAa5B,KAAMoC,EAAKC,EAAMC,EAAWO,KAErCJ,GAAUX,GACdA,EAAa9B,KAAMoC,EAAKC,EAAMC,EAAWQ,KAEnCV,GCrEJ5B,EAAUC,EACVC,EAAWH,EAefjB,EAjB+BO,IASbW,EAEAE,EC7Bde,EAAiB5B,EAmCrB,IAAAqB,EAZA,SAAmCkB,EAAKC,EAAMlC,GAC7CsB,EAAgBW,EAAKC,EAAM,CAC1BU,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ9C,MAASA,KCJXb,EAL+BO,ECA/B,IAAAqD,EAPA,SAAmB/C,GAClB,MAA0B,iBAAVA,GCbbgD,ECDUC,OAAO1D,UAAUyD,QDyB/B,IEvBIpC,EAAcN,EACd4C,EFUJ,SAAelD,GACd,IAEC,OADAgD,EAAQnD,KAAMG,IACP,EACN,MAAQW,GACT,OAAO,IEVL3B,EAPiBU,IA0CrB,IAAAyD,EAhBA,SAAmBnD,GAClB,MAAsB,iBAAVA,IACNA,aAAiBiD,SAGjBjE,EACGkE,EAAMlD,GAEoB,oBAAzBY,EAAaZ,MClCpBoD,EAAc1D,EACd2D,EAAW/C,EA0Bf,ICSIgD,EAAc5D,EACd6D,EDjBJ,SAAmBvD,GAClB,OAASoD,EAAapD,IAAWqD,EAAUrD,ICkBxCqD,EAAWG,EAKfF,EAAaC,EAAU,cANLnD,GAOlBkD,EAAaC,EAAU,WAAYF,GAKnC,IAAAlE,EAAiBoE,EClDbA,EAAW7D,EAAsC0D,YAKjDK,EAAW,yBAqDf,ICzCAtE,EDIA,SAAkBuE,GACjB,IACIC,EACAC,EAEJ,IAAML,EAAUG,GACf,MAAM,IAAInB,UAAW,uEAAyEmB,EAAM,MAGrG,GAAkB,MAAbA,EAAK,GAGT,IAAME,EADAF,EAAIG,OACI,EAAGD,GAAK,GACH,MAAbF,EAAKE,GADcA,KAO1B,YAAW,IAANA,GAAgBA,GAAK,EAClBF,EAAII,QAASL,EAAU,SAM/BE,GAHAA,EAAID,EAAIK,UAAW,EAAGH,IAGhBE,QAASL,EAAU,QAGzBC,EAAMA,EAAK,GAAMC,EAAID,EAAIK,UAAWH,KE/CrCI,GALS,ICyBT,IAAAjB,GAPA,SAAoB/C,GACnB,MAA0B,kBAAVA,GCjBbR,GCDWyE,QAAQ1E,UAAUC,SDyBjC,IEvBIoB,GAAcN,EACd4C,GFUJ,SAAelD,GACd,IAEC,OADAR,GAASK,KAAMG,IACR,EACN,MAAQW,GACT,OAAO,IEVL3B,GAPiBU,IA0CrB,IAAAyD,GAhBA,SAAoBnD,GACnB,MAAsB,iBAAVA,IACNA,aAAiBiE,UAGjBjF,GACGkE,GAAMlD,GAEoB,qBAAzBY,GAAaZ,MClCpBoD,GAAc1D,GACd2D,GAAW/C,GAkCf,ICAIgD,GAAc5D,EACdwE,GDRJ,SAAoBlE,GACnB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICSxCqD,GAAWG,GAKfF,GAAaY,GAAW,cANN9D,IAOlBkD,GAAaY,GAAW,WAAYb,IAKpC,IAAAlE,GAAiB+E,GCpCjB,IAAAC,GAPA,WACC,OAAO,IAAIC,SAAU,eAAd,ICFRC,GAL4B,iBAATC,KAAsBA,KAAO,KCKhDC,GAL8B,iBAAXC,OAAwBA,OAAS,6GCAhDvC,GAA0B,iBAAXwC,GAAwBA,GAAS,KAKpDC,OAAOC,QAAU1C,OCLbiC,GAAYxE,GAAuC0D,YACnDwB,GAAUtE,GACVuE,GAAOzE,GACP0E,GAAMtB,GACNuB,sCAkDJ,IAAAhE,GA7BA,SAAoBoD,GACnB,GAAKa,UAAUnB,OAAS,CACvB,IAAMK,GAAWC,GAChB,MAAM,IAAI5B,UAAW,+DAA+D4B,EAAQ,MAE7F,GAAKA,EACJ,OAAOS,KAKT,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,MAAM,IAAItC,MAAO,uDC3CdwC,GCOYvF,KDNZwF,GAAWD,GAAKE,UAAYF,GAAKE,SAASC,WER1CC,GAAavE,UCEbwE,GAAK5F,GACLwF,GHUaA,GGTbG,GDCaA,GC6BjB,IAAAE,GAnBA,WACC,MAEe,mBAAPD,IAGe,iBAAfD,IAGa,mBAAbH,ICST,IAAAnE,GAPA,WACC,MAAO,2BCEJyE,GAAiBlF,GADHZ,EAOL8F,GAAgB,SCjCR9F,MDsCrB,IAAAP,GAAiBqG,GEtCb5E,GAAclB,EAwClB,ICpBAP,GDWKsG,MAAMC,QACND,MAAMC,QARX,SAAkB1F,GACjB,MAAkC,mBAAzBY,GAAaZ,IEzBnB0F,GAAUhG,GC0Bd,ICGIiG,GDbJ,SAAuB3F,GACtB,OACW,OAAVA,GACiB,iBAAVA,GCQSN,EAOLiG,GAAc,oBFR3B,SAAmBC,GAClB,GAA0B,mBAAdA,EACX,MAAM,IAAIrD,UAAW,sDAAwDqD,EAAY,MAE1F,OASA,SAAgB5F,GACf,IAAI6F,EACAjC,EACJ,IAAM8B,GAAS1F,GACd,OAAO,EAGR,GAAa,KADb6F,EAAM7F,EAAM6D,QAEX,OAAO,EAER,IAAMD,EAAI,EAAGA,EAAIiC,EAAKjC,IACrB,IAAiC,IAA5BgC,EAAW5F,EAAO4D,IACtB,OAAO,EAGT,OAAO,GEpBuCkC,CAAUH,KAK1D,IAAAxG,GAAiBwG,GCvCbA,GAAejG,GA+CnB,IC3BAP,GDOA,SAAmBa,GAClB,OACC2F,GAAc3F,KAGbA,EAAM+F,WAEL/F,EAAMgG,aAGgC,mBAA/BhG,EAAMgG,YAAYC,UACzBjG,EAAMgG,YAAYC,SAAUjG,KEtC5BY,GAAclB,EACd4F,GAAKhF,GAA0C4F,OAC/CD,GAAW7F,GAuDf,IAAAW,GAxBA,SAA0BnB,GACzB,IAAIuG,EACAC,EACA/E,EAEJ,IAAe,YADf+E,EAAOxF,GAAahB,GAAIyG,MAAO,GAAI,KACC,UAATD,IAAqBxG,EAAEoG,YAAc,CAE/D,GAA0B,iBAD1B3E,EAAOzB,EAAEoG,aACQI,KAChB,OAAO/E,EAAK+E,KAGb,GADAD,EAAQb,GAAGgB,KAAMjF,EAAK7B,YAErB,OAAO2G,EAAO,GAGhB,OAAKF,GAAUrG,GACP,SAEDwG,GCnDJG,GCkBkB7G,GDmCtB,IErDI6G,GDkBkB7G,GCAtB,ICFI8G,GHkBJ,SAAiB5G,GAChB,IAAI6G,EAGJ,OAAW,OAAN7G,EACG,OAKM,YAHd6G,SAAc7G,GAIN2G,GAAU3G,GAAI8G,cAEfD,GG9BJlG,GDNJ,SAAiBX,GAChB,OAAO2G,GAAU3G,GAAI8G,eCetBvH,GAZkBO,KAOaa,GAAWiG,GCtBtCA,GAAS9G,GA2Bb,ICNAP,GDFA,SAAqBa,GAEpB,MAA6B,aAApBwG,GAAQxG,IErBdsG,GCFOK,OAAOpH,UAAU+G,KD0B5B,IEvBI1F,GAAcN,EACd4C,GFUJ,SAAelD,GACd,IAEC,OADAsG,GAAKzG,KAAMG,IACJ,EACN,MAAQW,GACT,OAAO,IEVL3B,GAPiBU,IA0CrB,IC1CIkH,GAAUlH,EACVmH,GAAavG,GACbiD,GAAWnD,EAAsCgD,YACjD0D,GDuBJ,SAAmB9G,GAClB,MAAsB,iBAAVA,IACNA,aAAiB2G,SAGjB3H,GACGkE,GAAMlD,GAEoB,oBAAzBY,GAAaZ,MC2BxB,ICvCAb,GDmBA,SAAkBuE,EAAKqD,EAAQC,GAC9B,IAAMzD,GAAUG,GACf,MAAM,IAAInB,UAAW,wEAA0EmB,EAAM,MAEtG,GAAKH,GAAUwD,GACdA,EAASH,GAASG,GAClBA,EAAS,IAAIJ,OAAQI,EAAQ,UAEzB,IAAMD,GAAUC,GACpB,MAAM,IAAIxE,UAAW,+FAAiGwE,EAAS,MAEhI,IAAMxD,GAAUyD,KAAaH,GAAYG,GACxC,MAAM,IAAIzE,UAAW,gGAAkGyE,EAAS,MAEjI,OAAOtD,EAAII,QAASiD,EAAQC,IEhC7B,IAAAjE,GAPA,SAAmB/C,GAClB,MAA0B,iBAAVA,GCAjBb,GCjBiB8H,OCAbzH,GCASE,GAMSH,UAAUC,SDkBhC,IEvBIoB,GAAcN,EACd2G,GAAS7G,GACT8C,GFSJ,SAAelD,GACd,IAEC,OADAR,GAASK,KAAMG,IACR,EACN,MAAQW,GACT,OAAO,IETL3B,GARiBU,IA2CrB,IAAAyD,GAhBA,SAAmBnD,GAClB,MAAsB,iBAAVA,IACNA,aAAiBiH,KAGjBjI,GACGkE,GAAMlD,GAEoB,oBAAzBY,GAAaZ,MCnCpBoD,GAAc1D,GACd2D,GAAW/C,GAkCf,ICOIgD,GAAc5D,EACdwH,GDfJ,SAAmBlH,GAClB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICgBxCqD,GAAWG,GAKfF,GAAa4D,GAAU,cANL9G,IAOlBkD,GAAa4D,GAAU,WAAY7D,IAKnC,IAAAlE,GAAiB+H,GCvBjB/H,GALmB8H,OAAOE,kBCS1BhI,GA1BaO,GAqBa0H,kBChCtBC,GCsBQC,KAAKD,MDIjB,IENAlI,GFDA,SAAoBoI,GACnB,OAAQF,GAAME,KAAOA,GGpBlBC,GAAO9H,GACP+H,GAAOnH,GACPoH,GAAQtH,GAuBZ,IAAAuH,GAXA,SAAoB3H,GACnB,OACCA,EAAQwH,IACRxH,EAAQyH,IACRC,GAAO1H,IClBLkH,GAAWxH,GAAsC0D,YACjDsE,GAAQpH,GA6BZ,IAAAyC,GAVA,SAAoB/C,GACnB,OACCkH,GAAUlH,IACV0H,GAAO1H,ICvBLkH,GAAWxH,GAAsC2D,SACjDqE,GAAQpH,GA6BZ,IAAA6C,GAVA,SAAoBnD,GACnB,OACCkH,GAAUlH,IACV0H,GAAO1H,EAAMgD,YCvBXI,GAAc1D,GACd2D,GAAW/C,GAkCf,ICMIgD,GAAc5D,EACdkI,GDdJ,SAAoB5H,GACnB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICexCqD,GAAWG,GAKfF,GAAasE,GAAW,cANNxH,IAOlBkD,GAAasE,GAAW,WAAYvE,IAKpC,IAAAlE,GAAiByI,GCvDbA,GAAYlI,GAAuC0D,YA6BvD,IAAAL,GAVA,SAA+B/C,GAC9B,OACC4H,GAAW5H,IACXA,GAAS,GCtBP4H,GAAYlI,GAAuC2D,SA6BvD,IAAAF,GAVA,SAA+BnD,GAC9B,OACC4H,GAAW5H,IACXA,EAAMgD,WAAa,GCtBjBI,GAAc1D,GACd2D,GAAW/C,GAsCf,ICGIgD,GAAc5D,EACdmI,GDXJ,SAA+B7H,GAC9B,OAASoD,GAAapD,IAAWqD,GAAUrD,ICYxCqD,GAAWG,GAKfF,GAAauE,GAAsB,cANjBzH,IAOlBkD,GAAauE,GAAsB,WAAYxE,IAK/C,IAAAlE,GAAiB0I,GCxDbC,GAAWxI,OAAOyI,eCatB,IAAAC,GARA,SAAmB/F,GAElB,OAAOA,EAAIO,WCPR5B,GAAclB,EACdoI,GAAWxH,GA+Bf,IAAAC,GAnBA,SAAyB0B,GACxB,IAAI+F,EAAQF,GAAU7F,GACtB,OAAK+F,GAAmB,OAAVA,EACNA,EAEgC,sBAAnCpH,GAAaqB,EAAI+D,aAEd/D,EAAI+D,YAAYzG,UAEnB0C,aAAe3C,OACZA,OAAOC,UAGR,MCzBJc,GHIayH,GGHbvH,GAAWH,GCFX0H,GDAapI,GAQAJ,OAAOyI,gBACZ1H,GAEAE,GCoBZ,ICdApB,GDFA,SAAyBa,GACxB,OACCA,QAGO,MAGRA,EAAQV,OAAQU,GAET8H,GAAU9H,KEzBd+H,GAAiBrI,GACjBkB,GAAcN,EAwClB,ICrBAnB,GDAA,SAAkBa,GACjB,GAAsB,iBAAVA,GAAgC,OAAVA,EACjC,OAAO,EAGR,GAAKA,aAAiByC,MACrB,OAAO,EAGR,KAAQzC,GAAQ,CACf,GAA8B,mBAAzBY,GAAaZ,GACjB,OAAO,EAERA,EAAQ+H,GAAgB/H,GAEzB,OAAO,GEdR,IAAAe,GAPA,WACC,MAAO,oCCWJkH,GAAW3H,GADGZ,EAOLuI,GAAU,SChCRvI,UCAX6D,GAAW7D,EAAsC0D,YACjD6E,GFyCaA,GEXjB,ICdA9I,GDAA,SAAuBuE,GACtB,IAAMH,GAAUG,GACf,MAAM,IAAInB,UAAW,uEAAyEmB,EAAM,MAMrG,OAHAA,EAAMuE,KAAW3B,KAAM5C,IAGN,IAAIiD,OAAQjD,EAAI,GAAIA,EAAI,IAAO,MEJjD,IAAA3C,GAPA,SAAgBwG,GACf,OAASA,GAAMA,GCfZL,GAAWxH,GAAsC0D,YACjD8E,GCcQxI,GDmBZ,IAAAqD,GAVA,SAAgB/C,GACf,OACCkH,GAAUlH,IACVkI,GAAOlI,IE3BLkH,GAAWxH,GAAsC2D,SACjD6E,GDcQxI,GCeZ,IAAAyD,GAVA,SAAgBnD,GACf,OACCkH,GAAUlH,IACVkI,GAAOlI,EAAMgD,YCvBXI,GAAc1D,GACd2D,GAAW/C,GAkCf,ICOIgD,GAAc5D,EACdyI,GDfJ,SAAgBnI,GACf,OAASoD,GAAapD,IAAWqD,GAAUrD,ICgBxCqD,GAAWG,GAKfF,GAAa6E,GAAO,cANF/H,IAOlBkD,GAAa6E,GAAO,WAAY9E,IAKhC,IAAAlE,GAAiBgJ,GCxDbP,GAAYlI,GAkChB,IClCIyI,GAAQzI,GACR0I,GDmBJ,SAAuBpI,GACtB,MACkB,iBAAVA,GACG,OAAVA,GACwB,iBAAjBA,EAAM6D,QACb+D,GAAW5H,EAAM6D,SACjB7D,EAAM6D,QAAU,GAChB7D,EAAM6D,QENqB,kBDnBzBN,GAAWnD,EAAsCgD,YACjDwE,GAAYpE,GAAuCJ,YA0GvD,IAAAiF,GAhDA,SAAkBlH,EAAKmH,EAAeC,GACrC,IAAI1C,EACAjC,EACJ,IAAMwE,GAAcjH,KAAUoC,GAAUpC,GACvC,MAAM,IAAIoB,UAAW,0EAA4EpB,EAAM,MAGxG,GAAa,KADb0E,EAAM1E,EAAI0C,QAET,OAAQ,EAET,GAA0B,IAArBmB,UAAUnB,OAAe,CAC7B,IAAM+D,GAAWW,GAChB,MAAM,IAAIhG,UAAW,6DAA+DgG,EAAY,MAEjG,GAAKA,GAAa,EAAI,CACrB,GAAKA,GAAa1C,EACjB,OAAQ,EAETjC,EAAI2E,OAEJ3E,EAAIiC,EAAM0C,GACD,IACR3E,EAAI,QAINA,EAAI,EAGL,GAAKuE,GAAOG,IACX,KAAQ1E,EAAIiC,EAAKjC,IAChB,GAAKuE,GAAOhH,EAAIyC,IACf,OAAOA,OAIT,KAAQA,EAAIiC,EAAKjC,IAChB,GAAKzC,EAAKyC,KAAQ0E,EACjB,OAAO1E,EAIV,OAAQ,GErDTzE,GALcO,GClBd,IAAAW,GAPA,SAAeL,GACd,OAAOV,OAAOkJ,KAAMlJ,OAAQU,KCrBzBwI,GAAO9I,GAmCX,IAAA+I,GAPA,WACC,OAlBD,WACC,OAA8C,KAArCD,GAAMxD,YAAe,IAAKnB,OAiB5BX,CAAM,EAAG,ICxBjBwF,QALoC,IAAhBpJ,OAAOkJ,KCAvB5H,GAAclB,EA+BlB,IC1BIwB,GD0BJH,GAPA,SAAsBf,GACrB,MAAkC,uBAAzBY,GAAaZ,ICzBnB2I,GAAcjJ,GA2BdkJ,GAPJ,WACC,OAAOD,GAAa3D,WAMd6D,GAKP,IC3BI3H,GD2BJ4H,GAAiB5H,GEDjB6H,GAL2BzJ,OAAOC,UAAUyJ,qBDHxCC,IAvBSvJ,GAiBGG,KAAM,OAAQ,KAW9B,IE5BI0D,GAAW7D,EACXyI,GAAQ7H,GAAmC8C,YAC3CwE,GAAYxH,GAAuCgD,YACnD8F,GAAS1F,GACT2F,GFwBajI,GE6BjB,IAAAH,GAzBA,SAA+Bf,EAAOC,GACrC,IAAIiB,EACJ,OACClB,YAKDkB,EAAOgI,GAAOrJ,KAAMG,EAAOC,KACbkJ,IAAoB5F,GAAUvD,IAIzCmI,GAFFlI,GAAYA,IAGX2H,GAAW3H,IACXA,GAAY,GACZA,EAAWD,EAAM6D,OAGZ3C,IC3BR/B,GAL2BO,GCnBvBS,GAAaT,EACb0J,GAAuB9I,GACvBoF,GAAUtF,GACVwH,GAAYpE,GCiChB,IAAArE,GAjBwBO,GACbY,GDQX,SAAsBN,GACrB,OACW,OAAVA,GACiB,iBAAVA,IACN0F,GAAS1F,IACc,iBAAjBA,EAAM6D,QACb+D,GAAW5H,EAAM6D,SACjB7D,EAAM6D,QAAU,GAChB7D,EAAM6D,QAhCSwF,YAiCflJ,GAAYH,EAAO,YAClBoJ,GAAsBpJ,EAAO,WEtC5B2I,GAAcjJ,GACdW,GAAUC,GAKV+F,GAAQZ,MAAMlG,UAAU8G,MA+B5B,IAAAiD,GAVA,SAAetJ,GACd,OAAK2I,GAAa3I,GACVK,GAASgG,GAAMxG,KAAMG,IAEtBK,GAASL,ICnBjB,ICAAuJ,GAZ2B7J,IDK3B,cCEuC,aCWvC8J,IAlB2B9J,GAKjB,CACTF,SAAY,MAO0B,YCCvC,ICJI0B,GDIJuI,GAPA,SAAiCzJ,GAChC,OAASA,EAAMgG,aAAehG,EAAMgG,YAAYzG,YAAcS,GER3D0J,GAAwB,oBAAXlF,YAA2B,EAASA,ODAjDrE,GAAaT,EACbiK,GAAUrJ,GACVkG,GAASpG,GACTwJ,GAAyBpG,GACzBqG,wPACAC,GCAaJ,GD2CbK,GAzBJ,WACC,IAAIC,EACJ,GAAuB,cAAlBxD,GAAQsD,IACZ,OAAO,EAER,IAAME,KAAKF,GACV,KAEmC,IAAjCH,GAASE,GAAeG,IACxB7J,GAAY2J,GAAKE,IACJ,OAAbF,GAAKE,IACkB,WAAvBxD,GAAQsD,GAAKE,KAEbJ,GAAwBE,GAAKE,IAE7B,MAAQrJ,GACT,OAAO,EAGT,OAAO,EAMDsJ,GAKP,IErDI/I,GAA2B,oBAAXsD,OCAhB0F,GHqDahJ,GGpDb0I,GAAyBtJ,GACzB6J,GDGajJ,GCuBjB,IC5BIyE,GAAejG,GACfS,GAAaG,EACbqI,GAAcvI,GACdgK,GAAqB5G,GACrB6G,GAAyBhB,GACzBO,GDSJ,SAAkB5J,GACjB,IAAoB,IAAfmK,KAAyBD,GAC7B,OAAON,GAAwB5J,GAEhC,IACC,OAAO4J,GAAwB5J,GAC9B,MAAQsK,GACT,OAAO,ICfLC,iHAyEJ,IC7EIlK,GAAUD,GACVoK,GAAUhH,GACVjD,GDuBJ,SAAeP,GACd,IAAIyK,EACAC,EACAC,EACAjK,EACAsJ,EACAY,EACAhH,EAGJ,GADAlD,EAAM,GACDiI,GAAa3I,GAAU,CAE3B,IAAM4D,EAAI,EAAGA,EAAI5D,EAAM6D,OAAQD,IAC9BlD,EAAImK,KAAMjH,EAAEpE,YAGb,OAAOkB,EAER,GAAsB,iBAAVV,GAEX,GAAKA,EAAM6D,OAAS,IAAM1D,GAAYH,EAAO,KAC5C,IAAM4D,EAAI,EAAGA,EAAI5D,EAAM6D,OAAQD,IAC9BlD,EAAImK,KAAMjH,EAAEpE,gBAGR,CAEN,IAAe,KADfmL,EAA2B,mBAAV3K,KACQ2F,GAAc3F,GACtC,OAAOU,EAERgK,EAAkBN,IAAsBO,EAEzC,IAAMX,KAAKhK,EACF0K,GAAuB,cAANV,IAAuB7J,GAAYH,EAAOgK,IAClEtJ,EAAImK,KAAM5H,OAAQ+G,IAGpB,GAAKK,GAEJ,IADAI,EAAkBb,GAAwB5J,GACpC4D,EAAI,EAAGA,EAAI2G,GAAe1G,OAAQD,IACvCgH,EAAIL,GAAgB3G,GACZ6G,GAAyB,gBAANG,IAAyBzK,GAAYH,EAAO4K,IACtElK,EAAImK,KAAM5H,OAAQ2H,IAIrB,OAAOlK,GEnDRvB,GDrBkBmB,GADIZ,KA6Bb8K,GAEAnK,GAGDE,GE7BRmI,QALmD,IAA/BpJ,OAAOwL,oBCAvBC,GAAgBzL,OAAOwL,oBAgC3B,IChCItC,GAAO9I,GCgCX,IAAAP,GAjBkBO,GFUlB,SAA8BM,GAC7B,OAAO+K,GAAezL,OAAQU,KCA/B,SAA8BA,GAC7B,OAAOwI,GAAMlJ,OAAQU,KEtBtB0I,QALwD,IAApCpJ,OAAO0L,yBCAvBC,GAAqB3L,OAAO0L,yBAuChC,ICvCI7K,GAAaT,ECkCjB,IAAAP,GAjBkBO,GFUlB,SAAmCM,EAAOC,GACzC,IAAIiL,EACJ,OAAKlL,cAIa,KADlBkL,EAAOD,GAAoBjL,EAAOC,IAF1B,KAG4BiL,GCLrC,SAAmClL,EAAOC,GACzC,OAAKE,GAAYH,EAAOC,GAChB,CACN2C,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ9C,MAASA,EAAOC,IAGX,iyqBEvBR,ICDIc,uJCb2BoK,ODc3B5K,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GAjB2BO,KASnBqB,GAEAR,GEjBJW,GANaxB,GACJY,GAKiB8K,MCN1BnF,GAAWvG,GACXyL,GAAS7K,GA+Bb,IAAAS,GAVA,SAAqBsK,GACpB,IAAMpF,GAAUoF,GACf,MAAM,IAAI9I,UAAW,oDAAsD8I,EAAS,KAErF,OAAOF,GAAOC,KAAMC,IC1BjBpF,GAAWvG,GACXyL,GAAS7K,GA+Bb,IAAAC,GAVA,SAAqB8K,GACpB,IAAMpF,GAAUoF,GACf,MAAM,IAAI9I,UAAW,oDAAsD8I,EAAS,KAErF,OAAO,IAAIF,GAAQE,ICOpBlM,GHtBiB+B,GGMNZ,GACIF,GCJf,ICDIC,GCb8B,mBAAdS,UAA6BA,eAAY,EDczDP,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GAjB0BO,IASlBW,GAEAE,GEvBJK,GAAclB,EAKd4L,GAAwC,mBAAfC,WA6B7B,IClCIxK,GAA+B,mBAAfwK,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuBxL,GACtB,OACGsL,IAAiBtL,aAAiBuL,YACX,wBAAzB3K,GAAaZ,IEzBXyL,GDGa1K,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArBsK,GACX,OAAO,EAGR,IAECtK,EAAM,IAAIsK,GADVtK,EAAM,CAAE,EAAG,MAAO,KAAMuK,IAAaA,MAErCxK,EACCsK,GAAcrK,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQuK,MAAbvK,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCb+B,mBAAfkL,WAA8BA,gBAAa,EDc3DhL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKdiM,GAAsD,mBAAtBC,kBA6BpC,IClCI7K,GAAsC,mBAAtB6K,kBAAqCA,kBAAoB,KCAzEC,GFwBJ,SAA8B7L,GAC7B,OACG2L,IAAwB3L,aAAiB4L,mBAClB,+BAAzBhL,GAAaZ,IE1BX8L,GDIa/K,GCuCjB,IAAAA,GA7BA,WACC,IAAIG,EACAC,EAEJ,GAAwC,mBAA5B2K,GACX,OAAO,EAGR,IACC3K,EAAM,IAAI2K,GAAyB,EAAG,EAAG,EAAG,EAAG,KAAM,KAAM,IAAK,MAChE5K,EACC2K,GAAqB1K,IACR,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,MAAbA,EAAK,IACQ,MAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbsC,mBAAtBuL,kBAAqCA,uBAAoB,EDczErL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjBkCO,KFS1BW,GAEAE,GGvBJK,GAAclB,EAKdqM,GAAwC,mBAAfC,WA6B7B,IClCIjL,GAA+B,mBAAfiL,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuBjM,GACtB,OACG+L,IAAiB/L,aAAiBgM,YACX,wBAAzBpL,GAAaZ,IExBXkM,GDEanL,GCsCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArB+K,GACX,OAAO,EAGR,IACC/K,EAAM,IAAI+K,GAAkB,CAAE,EAAG,MAAO,KAAMC,QAC9CjL,EACC+K,GAAc9K,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,QDDbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEvBR,ICDIb,GCb+B,mBAAf2L,WAA8BA,gBAAa,EDc3DzL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKd0M,GAA0C,mBAAhBC,YA6B9B,IClCItL,GAAgC,mBAAhBsL,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBtM,GACvB,OACGoM,IAAkBpM,aAAiBqM,aACZ,yBAAzBzL,GAAaZ,IEzBXuM,GDGaxL,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAkC,mBAAtBoL,GACX,OAAO,EAGR,IAECpL,EAAM,IAAIoL,GADVpL,EAAM,CAAE,EAAG,MAAO,KAAMqL,MAAcA,QAEtCtL,EACCoL,GAAenL,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQqL,QAAbrL,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbgC,mBAAhBgM,YAA+BA,iBAAc,EDc7D9L,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB4BO,KFSpBW,GAEAE,GGvBJK,GAAclB,EAKd+M,GAAwC,mBAAfC,WA6B7B,IClCI3L,GAA+B,mBAAf2L,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuB3M,GACtB,OACGyM,IAAiBzM,aAAiB0M,YACX,wBAAzB9L,GAAaZ,IExBX4M,GDEa7L,GCsCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArByL,GACX,OAAO,EAGR,IACCzL,EAAM,IAAIyL,GAAkB,CAAE,EAAG,MAAO,KAAMC,aAC9C3L,EACCyL,GAAcxL,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,aDDbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEvBR,ICDIb,GCb+B,mBAAfqM,WAA8BA,gBAAa,EDc3DnM,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKdoN,GAA0C,mBAAhBC,YA6B9B,IClCIhM,GAAgC,mBAAhBgM,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBhN,GACvB,OACG8M,IAAkB9M,aAAiB+M,aACZ,yBAAzBnM,GAAaZ,IEzBXiN,GDGalM,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAkC,mBAAtB8L,GACX,OAAO,EAGR,IAEC9L,EAAM,IAAI8L,GADV9L,EAAM,CAAE,EAAG,MAAO,KAAM+L,WAAcA,aAEtChM,EACC8L,GAAe7L,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ+L,aAAb/L,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbgC,mBAAhB0M,YAA+BA,iBAAc,EDc7DxM,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB4BO,KFSpBW,GAEAE,GGvBJK,GAAclB,EAKdyN,GAA4C,mBAAjBC,aA6B/B,IClCIrM,GAAiC,mBAAjBqM,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyBrN,GACxB,OACGmN,IAAmBnN,aAAiBoN,cACb,0BAAzBxM,GAAaZ,IE1BXwH,GAAOlH,GACPgN,GDGavM,GCqCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAmC,mBAAvBmM,GACX,OAAO,EAGR,IACCnM,EAAM,IAAImM,GAAoB,CAAE,EAAK,MAAO,KAAM,OAClDpM,EACCmM,GAAgBlM,IACH,IAAbA,EAAK,IACQ,oBAAbA,EAAK,KACS,oBAAdA,EAAK,IACLA,EAAK,KAAQqG,GAEb,MAAQ7G,GACTO,GAAO,EAER,OAAOA,GCtBR,ICDIb,GCbiC,mBAAjB+M,aAAgCA,kBAAe,EDc/D7M,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB6BO,KFSrBW,GAEAE,GGvBJK,GAAclB,EAKd6N,GAA4C,mBAAjBC,aA6B/B,IClCIzM,GAAiC,mBAAjByM,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyBzN,GACxB,OACGuN,IAAmBvN,aAAiBwN,cACb,0BAAzB5M,GAAaZ,IE1BX0N,GDIa3M,GCoCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAmC,mBAAvBuM,GACX,OAAO,EAGR,IACCvM,EAAM,IAAIuM,GAAoB,CAAE,EAAK,MAAO,KAAMC,MAClDzM,EACCuM,GAAgBtM,IACH,IAAbA,EAAK,IACQ,OAAbA,EAAK,KACS,OAAdA,EAAK,IACLA,EAAK,IAAQA,EAAK,GAElB,MAAQR,GACTO,GAAO,EAER,OAAOA,GCrBR,ICKIG,GANAhB,GCbiC,mBAAjBmN,aAAgCA,kBAAe,EDc/DjN,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCajBpB,GET4B3B,KFSrBW,GAEAE,GAMR,IG7BIO,GAAYpB,GACZ6L,GAAajL,GACbsL,GAAoBxL,GACpB4L,GAAaxI,GACb6I,GAAchD,GACdqD,GAAakB,GACbb,GAAcc,GACdT,GAAeU,GACfN,GHqBanM,GGJjB,SAAS0M,GAAW5M,GACnB,OAAO,IAAIL,GAAWK,GAUvB,SAAS6M,GAAY7M,GACpB,OAAO,IAAIoK,GAAYpK,GAUxB,SAAS8M,GAAmB9M,GAC3B,OAAO,IAAIyK,GAAmBzK,GAU/B,SAAS+M,GAAY/M,GACpB,OAAO,IAAI6K,GAAY7K,GAUxB,SAASgN,GAAahN,GACrB,OAAO,IAAIkL,GAAalL,GAUzB,SAASiN,GAAYjN,GACpB,OAAO,IAAIuL,GAAYvL,GAUxB,SAASkN,GAAalN,GACrB,OAAO,IAAI4L,GAAa5L,GAUzB,SAASmN,GAAcnN,GACtB,OAAO,IAAIiM,GAAcjM,GAU1B,SAASoN,GAAcpN,GACtB,OAAO,IAAIqM,GAAcrM,GAgC1B,IClJIhB,GAAaT,EACbgG,GAAUpF,GACV2F,GAAW7F,GACXoO,GAAUhL,GACVgD,GAAS6C,GACToF,GAASb,GACTjE,GAAUkE,GACVa,GAAaZ,GACb/C,GAAgB4D,GAChB1D,GAAqB2D,GACrB7G,GAAiB8G,GACjBvN,GAAiBwN,EACjBC,GAAaC,GACbC,GD+GO,CACTlB,UAAaA,GACbC,WAAcA,GACdC,kBAAqBA,GACrBC,WAAcA,GACdC,YAAeA,GACfC,WAAcA,GACdC,YAAeA,GACfC,aAAgBA,GAChBC,aAAgBA,ICQlB,SAASW,GAAUC,EAAKC,EAAMC,EAAOC,EAAMC,GAC1C,IAAIC,EACAhH,EACApC,EACA8E,EACA7J,EACAoO,EACAC,EACAnI,EACA3D,EACA+L,EAKJ,GAHAJ,GAAS,EAIO,iBAARJ,GACC,OAARA,EAEA,OAAOA,EAER,GAAKlJ,GAAUkJ,GACd,OAAOJ,GAAYI,GAEpB,GAAKX,GAASW,GACb,OAnFF,SAAoB7E,GACnB,IAEI9B,EACA0C,EACA0E,EACAH,EACA9O,EACAiD,EAPAyL,EAAQ,GACRC,EAAO,GA8BX,IArBA3O,EAAM,IAAI2J,EAAMtE,YAAasE,EAAMuF,SAEnCR,EAAMxE,KAAMP,GACZgF,EAAKzE,KAAMlK,GAGN2J,EAAMwF,QACVnP,EAAImP,MAAQxF,EAAMwF,OAGdxF,EAAMyF,OACVpP,EAAIoP,KAAOzF,EAAMyF,MAEbzF,EAAM0F,QACVrP,EAAIqP,MAAQ1F,EAAM0F,OAEd1F,EAAM2F,UACVtP,EAAIsP,QAAU3F,EAAM2F,SAGrBzH,EAAOkG,GAAYpE,GACb1G,EAAI,EAAGA,EAAI4E,EAAK3E,OAAQD,IAC7B6L,EAAMjH,EAAM5E,GACZsH,EAAOD,GAAoBX,EAAOmF,GAC7BtP,GAAY+K,EAAM,WACtB0E,EAAQlK,GAAS4E,EAAOmF,IAAY,GAAK,GACzCvE,EAAKlL,MAAQkP,GAAU5E,EAAOmF,GAAOG,EAAKP,EAAOC,GAAO,IAEzDhO,GAAgBX,EAAK8O,EAAKvE,GAE3B,OAAOvK,EA0CCuP,CAAWf,GAKnB,GAAc,UAFd/I,EAAOI,GAAQ2I,IAGd,OAAO,IAAIgB,MAAOhB,GAEnB,GAAc,WAAT/I,EACJ,OAAOqI,GAAQU,EAAI3P,YAEpB,GAAc,QAAT4G,EACJ,OAAO,IAAIgK,IAAKjB,GAEjB,GAAc,QAAT/I,EACJ,OAAO,IAAIiK,IAAKlB,GAEjB,GACU,WAAT/I,GACS,YAATA,GACS,WAATA,EAGA,OAAO+I,EAAInM,UAGZ,GADA3B,EAAO4N,GAAa7I,GAEnB,OAAO/E,EAAM8N,GAGd,GACU,UAAT/I,GACS,WAATA,EAGA,MAA8B,mBAAlB9G,OAAOgR,OA1KrB,SAAwBnB,GACvB,IAAIE,EACAkB,EACAnK,EACAkJ,EACApE,EACA0E,EACAF,EACA9L,EAUJ,IARAyL,EAAQ,GACRC,EAAO,GAEPI,EAAMpQ,OAAOkR,OAAQzI,GAAgBoH,IACrCE,EAAMxE,KAAMsE,GACZG,EAAKzE,KAAM6E,GAEXa,EAAQxF,GAAeoE,GACjBvL,EAAI,EAAGA,EAAI2M,EAAM1M,OAAQD,IAC9BwC,EAAOmK,EAAO3M,GACdsH,EAAOD,GAAoBkE,EAAK/I,GAC3BjG,GAAY+K,EAAM,WACtB0E,EAAQlK,GAASyJ,EAAI/I,IAAY,GAAK,GACtC8E,EAAKlL,MAAQkP,GAAUC,EAAI/I,GAAOwJ,EAAKP,EAAOC,GAAO,IAEtDhO,GAAgBoO,EAAKtJ,EAAM8E,GAW5B,OATM5L,OAAOmR,aAActB,IAC1B7P,OAAOoR,kBAAmBhB,GAEtBpQ,OAAOqR,SAAUxB,IACrB7P,OAAOsR,KAAMlB,GAETpQ,OAAOuR,SAAU1B,IACrB7P,OAAOgR,OAAQZ,GAETA,EAuIEoB,CAAe3B,GAEhB,GAIR,GADA3G,EAAOkG,GAAYS,GACdI,EAAQ,EAEZ,IADAC,EAASpJ,EACHuJ,EAAI,EAAGA,EAAInH,EAAK3E,OAAQ8L,IAE7BpI,EAAI4H,EADJM,EAAMjH,EAAMmH,IAIZvJ,EAAOI,GAAQe,GAED,iBAANA,GACD,OAANA,GAEU,UAATnB,GACS,WAATA,GAEDH,GAAUsB,GAEM,WAAXiI,GACJtE,EAAOD,GAAoBkE,EAAKM,GAC3BtP,GAAY+K,EAAM,WACtBA,EAAKlL,MAAQkP,GAAU3H,IAExBjG,GAAgB8N,EAAMK,EAAKvE,IAE3BkE,EAAMK,GAAQP,GAAU3H,IAMd,KADZ3D,EAAI+F,GAAS0F,EAAO9H,KAMpBmI,EAAQhK,GAAS6B,GAAQ,IAAI9B,MAAO8B,EAAE1D,QAAW,GACjDwL,EAAMxE,KAAMtD,GACZ+H,EAAKzE,KAAM6E,GACK,UAAXF,EACJJ,EAAMK,GAAQP,GAAU3H,EAAGmI,EAAKL,EAAOC,EAAMC,IAE7CrE,EAAOD,GAAoBkE,EAAKM,GAC3BtP,GAAY+K,EAAM,WACtBA,EAAKlL,MAAQkP,GAAU3H,EAAGmI,EAAKL,EAAOC,EAAMC,IAE7CjO,GAAgB8N,EAAMK,EAAKvE,KAd3BkE,EAAMK,GAAQH,EAAM1L,QAiBhB,GAAc,UAATwC,EACX,IAAMuJ,EAAI,EAAGA,EAAInH,EAAK3E,OAAQ8L,IAE7BP,EADAK,EAAMjH,EAAMmH,IACER,EAAKM,QAGpB,IAAME,EAAI,EAAGA,EAAInH,EAAK3E,OAAQ8L,IAC7BF,EAAMjH,EAAMmH,GACZzE,EAAOD,GAAoBkE,EAAKM,GAChCnO,GAAgB8N,EAAMK,EAAKvE,GAY7B,OATM5L,OAAOmR,aAActB,IAC1B7P,OAAOoR,kBAAmBtB,GAEtB9P,OAAOqR,SAAUxB,IACrB7P,OAAOsR,KAAMxB,GAET9P,OAAOuR,SAAU1B,IACrB7P,OAAOgR,OAAQlB,GAETA,EAMR,IC3RI1J,GAAUhG,GACVmI,GAAuBvH,GAAmD8C,YAC1EoE,GAAOpH,GACP8O,GDwRaA,GCtOjB,IAAA6B,GAnBA,SAAe/Q,EAAOuP,GACrB,IAAI7O,EACJ,GAAKsE,UAAUnB,OAAS,EAAI,CAC3B,IAAMgE,GAAsB0H,GAC3B,MAAM,IAAIhN,UAAW,oEAAsEgN,EAAQ,MAEpG,GAAe,IAAVA,EACJ,OAAOvP,OAGRuP,EAAQ/H,GAGT,OADA9G,EAAQgF,GAAS1F,GAAY,IAAIyF,MAAOzF,EAAM6D,QAAW,GAClDqL,GAAUlP,EAAOU,EAAK,CAACV,GAAQ,CAACU,GAAM6O,ICd9CpQ,GALWO,GC5BPgG,GAAUhG,GA8Bd,IC9BI2D,GDmBJ,SAAmBrD,GAClB,MACkB,iBAAVA,GACG,OAAVA,IACC0F,GAAS1F,ICtBR6G,GAAavG,GACbyH,GAAiB3H,GACjBD,GAAaqD,EACb5C,GAAcyI,EAKd2H,GAAkB1R,OAAOC,UAgF7B,IAAAwB,GAvCA,SAAwBf,GACvB,IAAIgI,EAGJ,QAAM3E,GAAUrD,OAIhBgI,EAAQD,GAAgB/H,MAOtBG,GAAYH,EAAO,gBAGpBG,GAAY6H,EAAO,gBACnBnB,GAAYmB,EAAMhC,cACmB,sBAArCpF,GAAaoH,EAAMhC,cAGnB7F,GAAY6H,EAAO,kBACnBnB,GAAYmB,EAAMiJ,iBAIjBjJ,IAAUgJ,IAzDb,SAAmB/O,GAClB,IAAIwN,EAGJ,IAAMA,KAAOxN,EACZ,IAAM9B,GAAY8B,EAAKwN,GACtB,OAAO,EAGT,OAAO,EAmDLyB,CAAUlR,MCjFTqD,GCegB3D,GDdhBS,GAAaG,EACbiD,GAAWnD,EAAsCgD,YAqCrD,wJEvCIU,GAAUpE,GACV0P,GAAO9O,GACP6Q,GFeJ,SAAmBC,EAAMC,GACxB,OAAMhO,GAAUgO,GAGXlR,GAAYkR,EAAS,SACzBD,EAAKE,IAAMD,EAAQC,KACb/N,GAAU6N,EAAKE,MACb,IAAI/O,UAAW,qEAAuE6O,EAAKE,IAAM,MAGrGnR,GAAYkR,EAAS,aACzBD,EAAKvB,QAAUwB,EAAQxB,SACjBtM,GAAU6N,EAAKvB,UACb,IAAItN,UAAW,yEAA2E6O,EAAKvB,QAAU,MAG3G,KAdC,IAAItN,UAAW,iEAAmE8O,EAAU,OEhBjGE,GAAW/N,GAwDf,IAAAgO,GAnCA,SAAkBH,GACjB,IAAID,EACAzQ,EAGJ,GAFAyQ,EAAOhC,GAAMmC,IACb5Q,EAAMwQ,GAAUC,EAAMC,GAErB,MAAM1Q,EAEP,OAUA,WACC,IAEI8Q,EACA7N,EAHAmM,EAAO/K,UAAW,GAClBsM,EAAMF,EAAKE,IAAM,SAASvB,EAG9B,IAAMnM,EAAI,EAAGA,EAAIoB,UAAUnB,OAAQD,IAClC0N,GAAO,UAAYI,mBAAoB1M,UAAWpB,IAInD,OAFA6N,EAAM3N,GAASsN,EAAKvB,QAAS,UAAWyB,GACxCG,EAAM3N,GAAS2N,EAAK,WAAY1B,KCtC9B4B,GCbUjS,GACCY,IDWGZ,EAOLiS,GAAwB,UALvBvR,IAUd,IAAAjB,GAAiBwS,UEJZC,IACGvR,ECZR,WACC,MAAM,IAAIoC,MAAOoP,GAAQ"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..a2f1cbe --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=r()}(this,(function(){"use strict";function t(t){var r=t.default;if("function"==typeof r){var n=function(){return r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var e=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,e.get?e:{enumerable:!0,get:function(){return t[r]}})})),n}var r=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();var n=function(){return r&&"symbol"==typeof Symbol.toStringTag},e=Object.prototype.toString,o=e;var i=function(t){return o.call(t)},u=Object.prototype.hasOwnProperty;var f=function(t,r){return null!=t&&u.call(t,r)},a="function"==typeof Symbol?Symbol.toStringTag:"",c=f,s=a,l=e;var h=i,p=function(t){var r,n,e;if(null==t)return l.call(t);n=t[s],r=c(t,s);try{t[s]=void 0}catch(r){return l.call(t)}return e=l.call(t),r?t[s]=n:delete t[s],e},y=n()?p:h,v=y,g="function"==typeof Int8Array;var w="function"==typeof Int8Array?Int8Array:null,d=function(t){return g&&t instanceof Int8Array||"[object Int8Array]"===v(t)},b=w;var m=function(){var t,r;if("function"!=typeof b)return!1;try{r=new b([1,3.14,-3.14,128]),t=d(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t},A=m,E="function"==typeof Int8Array?Int8Array:void 0,_="function"==typeof Object.defineProperty?Object.defineProperty:null;var O=function(){try{return _({},"x",{}),!0}catch(t){return!1}},P=Object.defineProperty,j=Object.prototype,R=j.toString,T=j.__defineGetter__,U=j.__defineSetter__,I=j.__lookupGetter__,S=j.__lookupSetter__;var B=function(t,r,n){var e,o,i,u;if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof n||null===n||"[object Array]"===R.call(n))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+n+"`.");if((o="value"in n)&&(I.call(t,r)||S.call(t,r)?(e=t.__proto__,t.__proto__=j,delete t[r],t[r]=n.value,t.__proto__=e):t[r]=n.value),i="get"in n,u="set"in n,o&&(i||u))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return i&&T&&T.call(t,r,n.get),u&&U&&U.call(t,r,n.set),t},Y=P,x=B,C=O()?Y:x,M=C;var L=function(t,r,n){M(t,r,{configurable:!1,enumerable:!1,writable:!1,value:n})},F=L;var D=function(t){return"string"==typeof t},N=String.prototype.valueOf;var k=y,V=function(t){try{return N.call(t),!0}catch(t){return!1}},z=n();var G=function(t){return"object"==typeof t&&(t instanceof String||(z?V(t):"[object String]"===k(t)))},X=D,$=G;var H=F,W=function(t){return X(t)||$(t)},q=G;H(W,"isPrimitive",D),H(W,"isObject",q);var J=W,Z=J.isPrimitive,K=/[-\/\\^$*+?.()|[\]{}]/g;var Q=function(t){var r,n;if(!Z(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");if("/"===t[0])for(n=t.length-1;n>=0&&"/"!==t[n];n--);return void 0===n||n<=0?t.replace(K,"\\$&"):(r=(r=t.substring(1,n)).replace(K,"\\$&"),t=t[0]+r+t.substring(n))},tt=/./;var rt=function(t){return"boolean"==typeof t},nt=Boolean.prototype.toString;var et=y,ot=function(t){try{return nt.call(t),!0}catch(t){return!1}},it=n();var ut=function(t){return"object"==typeof t&&(t instanceof Boolean||(it?ot(t):"[object Boolean]"===et(t)))},ft=rt,at=ut;var ct=F,st=function(t){return ft(t)||at(t)},lt=ut;ct(st,"isPrimitive",rt),ct(st,"isObject",lt);var ht=st;var pt=function(){return new Function("return this;")()},yt="object"==typeof self?self:null,vt="object"==typeof window?window:null,gt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},wt="object"==typeof gt?gt:null;module.exports=wt;var dt=ht.isPrimitive,bt=pt,mt=yt,At=vt,Et=t(Object.freeze({__proto__:null}));var _t=function(t){if(arguments.length){if(!dt(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return bt()}if(mt)return mt;if(At)return At;if(Et)return Et;throw new Error("unexpected error. Unable to resolve global object.")},Ot=_t(),Pt=Ot.document&&Ot.document.childNodes,jt=Int8Array,Rt=tt,Tt=Pt,Ut=jt;var It=function(){return"function"==typeof Rt||"object"==typeof Ut||"function"==typeof Tt};var St=function(){return/^\s*function\s*([^(]*)/i},Bt=St;F(Bt,"REGEXP",St());var Yt=Bt,xt=y;var Ct=Array.isArray?Array.isArray:function(t){return"[object Array]"===xt(t)},Mt=Ct;var Lt=function(t){return null!==t&&"object"==typeof t};F(Lt,"isObjectLikeArray",function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(r){var n,e;if(!Mt(r))return!1;if(0===(n=r.length))return!1;for(e=0;ejr&&Rr(t)},Ur=mr.isPrimitive,Ir=Tr;var Sr=function(t){return Ur(t)&&Ir(t)},Br=mr.isObject,Yr=Tr;var xr=function(t){return Br(t)&&Yr(t.valueOf())},Cr=Sr,Mr=xr;var Lr=F,Fr=function(t){return Cr(t)||Mr(t)},Dr=xr;Lr(Fr,"isPrimitive",Sr),Lr(Fr,"isObject",Dr);var Nr=Fr,kr=Nr.isPrimitive;var Vr=function(t){return kr(t)&&t>=0},zr=Nr.isObject;var Gr=function(t){return zr(t)&&t.valueOf()>=0},Xr=Vr,$r=Gr;var Hr=F,Wr=function(t){return Xr(t)||$r(t)},qr=Gr;Hr(Wr,"isPrimitive",Vr),Hr(Wr,"isObject",qr);var Jr=Wr,Zr=Object.getPrototypeOf;var Kr=function(t){return t.__proto__},Qr=y,tn=Kr;var rn=function(t){var r=tn(t);return r||null===r?r:"[object Function]"===Qr(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null},nn=Zr,en=rn,on=Zt(Object.getPrototypeOf)?nn:en;var un=function(t){return null==t?null:(t=Object(t),on(t))},fn=un,an=y;var cn=function(t){if("object"!=typeof t||null===t)return!1;if(t instanceof Error)return!0;for(;t;){if("[object Error]"===an(t))return!0;t=fn(t)}return!1};var sn=function(){return/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/},ln=sn;F(ln,"REGEXP",sn());var hn=J.isPrimitive,pn=ln;var yn=function(t){if(!hn(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");return(t=pn().exec(t))?new RegExp(t[1],t[2]):null};var vn=function(t){return t!=t},gn=mr.isPrimitive,wn=vn;var dn=function(t){return gn(t)&&wn(t)},bn=mr.isObject,mn=vn;var An=function(t){return bn(t)&&mn(t.valueOf())},En=dn,_n=An;var On=F,Pn=function(t){return En(t)||_n(t)},jn=An;On(Pn,"isPrimitive",dn),On(Pn,"isObject",jn);var Rn=Pn,Tn=Or;var Un=Rn,In=function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Tn(t.length)&&t.length>=0&&t.length<=9007199254740991},Sn=J.isPrimitive,Bn=Nr.isPrimitive;var Yn=function(t,r,n){var e,o;if(!In(t)&&!Sn(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(e=t.length))return-1;if(3===arguments.length){if(!Bn(n))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+n+"`.");if(n>=0){if(n>=e)return-1;o=n}else(o=e+n)<0&&(o=0)}else o=0;if(Un(r)){for(;o=0&&r=0&&t.length<=4294967295&&Qn(t,"callee")&&!te(t,"callee")},oe=ee,ie=Cn,ue=Array.prototype.slice;var fe=function(t){return oe(t)?ie(ue.call(t)):ie(t)};var ae=Kn((function(){}),"prototype"),ce=!Kn({toString:null},"toString");var se,le=function(t){return t.constructor&&t.constructor.prototype===t},he="undefined"==typeof window?void 0:window,pe=f,ye=xn,ve=qt,ge=le,we=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],de=he;se=function(){var t;if("undefined"===ve(de))return!1;for(t in de)try{-1===ye(we,t)&&pe(de,t)&&null!==de[t]&&"object"===ve(de[t])&&ge(de[t])}catch(t){return!0}return!1}();var be="undefined"!=typeof window,me=se,Ae=le,Ee=be;var _e=Ft,Oe=f,Pe=ee,je=ae,Re=ce,Te=function(t){if(!1===Ee&&!me)return Ae(t);try{return Ae(t)}catch(t){return!1}},Ue=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var Ie=Cn,Se=fe,Be=function(t){var r,n,e,o,i,u,f;if(o=[],Pe(t)){for(f=0;f0&&!Oe(t,"0"))for(f=0;f>18&63]+Ve[o>>12&63]+Ve[o>>6&63]+Ve[63&o]);return i.join("")}function We(t){var r;Xe||$e();for(var n=t.length,e=n%3,o="",i=[],u=16383,f=0,a=n-e;fa?a:f+u));return 1===e?(r=t[n-1],o+=Ve[r>>2],o+=Ve[r<<4&63],o+="=="):2===e&&(r=(t[n-2]<<8)+t[n-1],o+=Ve[r>>10],o+=Ve[r>>4&63],o+=Ve[r<<2&63],o+="="),i.push(o),i.join("")}function qe(t,r,n,e,o){var i,u,f=8*o-e-1,a=(1<>1,s=-7,l=n?o-1:0,h=n?-1:1,p=t[r+l];for(l+=h,i=p&(1<<-s)-1,p>>=-s,s+=f;s>0;i=256*i+t[r+l],l+=h,s-=8);for(u=i&(1<<-s)-1,i>>=-s,s+=e;s>0;u=256*u+t[r+l],l+=h,s-=8);if(0===i)i=1-c;else{if(i===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,e),i-=c}return(p?-1:1)*u*Math.pow(2,i-e)}function Je(t,r,n,e,o,i){var u,f,a,c=8*i-o-1,s=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=e?0:i-1,y=e?1:-1,v=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-u))<1&&(u--,a*=2),(r+=u+l>=1?h/a:h*Math.pow(2,1-l))*a>=2&&(u++,a/=2),u+l>=s?(f=0,u=s):u+l>=1?(f=(r*a-1)*Math.pow(2,o),u+=l):(f=r*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[n+p]=255&f,p+=y,f/=256,o-=8);for(u=u<0;t[n+p]=255&u,p+=y,u/=256,c-=8);t[n+p-y]|=128*v}var Ze={}.toString,Ke=Array.isArray||function(t){return"[object Array]"==Ze.call(t)};no.TYPED_ARRAY_SUPPORT=void 0===gt.TYPED_ARRAY_SUPPORT||gt.TYPED_ARRAY_SUPPORT;var Qe=to();function to(){return no.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ro(t,r){if(to()=to())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+to().toString(16)+" bytes");return 0|t}function ao(t){return!(null==t||!t._isBuffer)}function co(t,r){if(ao(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Lo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Fo(t).length;default:if(e)return Lo(t).length;r=(""+r).toLowerCase(),e=!0}}function so(t,r,n){var e=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return jo(this,r,n);case"utf8":case"utf-8":return Eo(this,r,n);case"ascii":return Oo(this,r,n);case"latin1":case"binary":return Po(this,r,n);case"base64":return Ao(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ro(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),e=!0}}function lo(t,r,n){var e=t[r];t[r]=t[n],t[n]=e}function ho(t,r,n,e,o){if(0===t.length)return-1;if("string"==typeof n?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=no.from(r,e)),ao(r))return 0===r.length?-1:po(t,r,n,e,o);if("number"==typeof r)return r&=255,no.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):po(t,[r],n,e,o);throw new TypeError("val must be string, number or Buffer")}function po(t,r,n,e,o){var i,u=1,f=t.length,a=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(t.length<2||r.length<2)return-1;u=2,f/=2,a/=2,n/=2}function c(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var s=-1;for(i=n;if&&(n=f-a),i=n;i>=0;i--){for(var l=!0,h=0;ho&&(e=o):e=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");e>i/2&&(e=i/2);for(var u=0;u>8,o=n%256,i.push(o),i.push(e);return i}(r,t.length-n),t,n,e)}function Ao(t,r,n){return 0===r&&n===t.length?We(t):We(t.slice(r,n))}function Eo(t,r,n){n=Math.min(t.length,n);for(var e=[],o=r;o239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(s=c);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&c)<<6|63&i)>127&&(s=a);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(a=(15&c)<<12|(63&i)<<6|63&u)>2047&&(a<55296||a>57343)&&(s=a);break;case 4:i=t[o+1],u=t[o+2],f=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&f)&&(a=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&f)>65535&&a<1114112&&(s=a)}null===s?(s=65533,l=1):s>65535&&(s-=65536,e.push(s>>>10&1023|55296),s=56320|1023&s),e.push(s),o+=l}return function(t){var r=t.length;if(r<=_o)return String.fromCharCode.apply(String,t);var n="",e=0;for(;e0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},no.prototype.compare=function(t,r,n,e,o){if(!ao(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===e&&(e=0),void 0===o&&(o=this.length),r<0||n>t.length||e<0||o>this.length)throw new RangeError("out of range index");if(e>=o&&r>=n)return 0;if(e>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(e>>>=0),u=(n>>>=0)-(r>>>=0),f=Math.min(i,u),a=this.slice(e,o),c=t.slice(r,n),s=0;so)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var i=!1;;)switch(e){case"hex":return yo(this,t,r,n);case"utf8":case"utf-8":return vo(this,t,r,n);case"ascii":return go(this,t,r,n);case"latin1":case"binary":return wo(this,t,r,n);case"base64":return bo(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mo(this,t,r,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),i=!0}},no.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _o=4096;function Oo(t,r,n){var e="";n=Math.min(t.length,n);for(var o=r;oe)&&(n=e);for(var o="",i=r;in)throw new RangeError("Trying to access beyond buffer length")}function Uo(t,r,n,e,o,i){if(!ao(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function Io(t,r,n,e){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-n,2);o>>8*(e?o:1-o)}function So(t,r,n,e){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-n,4);o>>8*(e?o:3-o)&255}function Bo(t,r,n,e,o,i){if(n+e>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Yo(t,r,n,e,o){return o||Bo(t,0,n,4),Je(t,r,n,e,23,4),n+4}function xo(t,r,n,e,o){return o||Bo(t,0,n,8),Je(t,r,n,e,52,8),n+8}no.prototype.slice=function(t,r){var n,e=this.length;if((t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r0&&(o*=256);)e+=this[t+--r]*o;return e},no.prototype.readUInt8=function(t,r){return r||To(t,1,this.length),this[t]},no.prototype.readUInt16LE=function(t,r){return r||To(t,2,this.length),this[t]|this[t+1]<<8},no.prototype.readUInt16BE=function(t,r){return r||To(t,2,this.length),this[t]<<8|this[t+1]},no.prototype.readUInt32LE=function(t,r){return r||To(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},no.prototype.readUInt32BE=function(t,r){return r||To(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},no.prototype.readIntLE=function(t,r,n){t|=0,r|=0,n||To(t,r,this.length);for(var e=this[t],o=1,i=0;++i=(o*=128)&&(e-=Math.pow(2,8*r)),e},no.prototype.readIntBE=function(t,r,n){t|=0,r|=0,n||To(t,r,this.length);for(var e=r,o=1,i=this[t+--e];e>0&&(o*=256);)i+=this[t+--e]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},no.prototype.readInt8=function(t,r){return r||To(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},no.prototype.readInt16LE=function(t,r){r||To(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},no.prototype.readInt16BE=function(t,r){r||To(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},no.prototype.readInt32LE=function(t,r){return r||To(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},no.prototype.readInt32BE=function(t,r){return r||To(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},no.prototype.readFloatLE=function(t,r){return r||To(t,4,this.length),qe(this,t,!0,23,4)},no.prototype.readFloatBE=function(t,r){return r||To(t,4,this.length),qe(this,t,!1,23,4)},no.prototype.readDoubleLE=function(t,r){return r||To(t,8,this.length),qe(this,t,!0,52,8)},no.prototype.readDoubleBE=function(t,r){return r||To(t,8,this.length),qe(this,t,!1,52,8)},no.prototype.writeUIntLE=function(t,r,n,e){(t=+t,r|=0,n|=0,e)||Uo(this,t,r,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+n},no.prototype.writeUInt8=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,1,255,0),no.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},no.prototype.writeUInt16LE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,2,65535,0),no.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Io(this,t,r,!0),r+2},no.prototype.writeUInt16BE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,2,65535,0),no.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Io(this,t,r,!1),r+2},no.prototype.writeUInt32LE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,4,4294967295,0),no.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):So(this,t,r,!0),r+4},no.prototype.writeUInt32BE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,4,4294967295,0),no.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):So(this,t,r,!1),r+4},no.prototype.writeIntLE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);Uo(this,t,r,n,o-1,-o)}var i=0,u=1,f=0;for(this[r]=255&t;++i>0)-f&255;return r+n},no.prototype.writeIntBE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);Uo(this,t,r,n,o-1,-o)}var i=n-1,u=1,f=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===f&&0!==this[r+i+1]&&(f=1),this[r+i]=(t/u>>0)-f&255;return r+n},no.prototype.writeInt8=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,1,127,-128),no.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},no.prototype.writeInt16LE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,2,32767,-32768),no.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Io(this,t,r,!0),r+2},no.prototype.writeInt16BE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,2,32767,-32768),no.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Io(this,t,r,!1),r+2},no.prototype.writeInt32LE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,4,2147483647,-2147483648),no.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):So(this,t,r,!0),r+4},no.prototype.writeInt32BE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),no.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):So(this,t,r,!1),r+4},no.prototype.writeFloatLE=function(t,r,n){return Yo(this,t,r,!0,n)},no.prototype.writeFloatBE=function(t,r,n){return Yo(this,t,r,!1,n)},no.prototype.writeDoubleLE=function(t,r,n){return xo(this,t,r,!0,n)},no.prototype.writeDoubleBE=function(t,r,n){return xo(this,t,r,!1,n)},no.prototype.copy=function(t,r,n,e){if(n||(n=0),e||0===e||(e=this.length),r>=t.length&&(r=t.length),r||(r=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(i<1e3||!no.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&n<57344){if(!o){if(n>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===e){(r-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(r-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((r-=1)<0)break;i.push(n)}else if(n<2048){if((r-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((r-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Fo(t){return function(t){var r,n,e,o,i,u;Xe||$e();var f=t.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[f-2]?2:"="===t[f-1]?1:0,u=new Ge(3*f/4-i),e=i>0?f-4:f;var a=0;for(r=0,n=0;r>16&255,u[a++]=o>>8&255,u[a++]=255&o;return 2===i?(o=ze[t.charCodeAt(r)]<<2|ze[t.charCodeAt(r+1)]>>4,u[a++]=255&o):1===i&&(o=ze[t.charCodeAt(r)]<<10|ze[t.charCodeAt(r+1)]<<4|ze[t.charCodeAt(r+2)]>>2,u[a++]=o>>8&255,u[a++]=255&o),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Co,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Do(t,r,n,e){for(var o=0;o=r.length||o>=t.length);++o)r[o+n]=t[o];return o}function No(t){return null!=t&&(!!t._isBuffer||ko(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ko(t.slice(0,0))}(t))}function ko(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Vo=Object.freeze({__proto__:null,Buffer:no,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),no.alloc(+t)},isBuffer:No,kMaxLength:Qe}),zo=no;module.exports=zo;var Go=Nt,Xo=t(Object.freeze({__proto__:null}));var $o=function(){var t,r;if("function"!=typeof Xo)return!1;try{r="function"==typeof Xo.from?Xo.from([1,2,3,4]):new Xo([1,2,3,4]),t=Go(r)&&1===r[0]&&2===r[1]&&3===r[2]&&4===r[3]}catch(r){t=!1}return t},Ho=$o;var Wo=t(Vo).Buffer,qo=function(){throw new Error("not implemented")},Jo=Ho()?Wo:qo,Zo=Zt(Jo.from),Ko=Nt,Qo=Jo;var ti=function(t){if(!Ko(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return Qo.from(t)},ri=Nt,ni=Jo;var ei=function(t){if(!ri(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return new ni(t)},oi=Zo?ti:ei;var ii="function"==typeof Int8Array?Int8Array:void 0,ui=function(){throw new Error("not implemented")},fi=A()?ii:ui,ai=y,ci="function"==typeof Uint8Array;var si="function"==typeof Uint8Array?Uint8Array:null,li=function(t){return ci&&t instanceof Uint8Array||"[object Uint8Array]"===ai(t)},hi=si;var pi=function(){var t,r;if("function"!=typeof hi)return!1;try{r=new hi(r=[1,3.14,-3.14,256,257]),t=li(r)&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var yi="function"==typeof Uint8Array?Uint8Array:void 0,vi=function(){throw new Error("not implemented")},gi=pi()?yi:vi,wi=y,di="function"==typeof Uint8ClampedArray;var bi="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null,mi=function(t){return di&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===wi(t)},Ai=bi;var Ei=function(){var t,r;if("function"!=typeof Ai)return!1;try{r=new Ai([-1,0,1,3.14,4.99,255,256]),t=mi(r)&&0===r[0]&&0===r[1]&&1===r[2]&&3===r[3]&&5===r[4]&&255===r[5]&&255===r[6]}catch(r){t=!1}return t};var _i="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,Oi=function(){throw new Error("not implemented")},Pi=Ei()?_i:Oi,ji=y,Ri="function"==typeof Int16Array;var Ti="function"==typeof Int16Array?Int16Array:null,Ui=function(t){return Ri&&t instanceof Int16Array||"[object Int16Array]"===ji(t)},Ii=Ti;var Si=function(){var t,r;if("function"!=typeof Ii)return!1;try{r=new Ii([1,3.14,-3.14,32768]),t=Ui(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t};var Bi="function"==typeof Int16Array?Int16Array:void 0,Yi=function(){throw new Error("not implemented")},xi=Si()?Bi:Yi,Ci=y,Mi="function"==typeof Uint16Array;var Li="function"==typeof Uint16Array?Uint16Array:null,Fi=function(t){return Mi&&t instanceof Uint16Array||"[object Uint16Array]"===Ci(t)},Di=Li;var Ni=function(){var t,r;if("function"!=typeof Di)return!1;try{r=new Di(r=[1,3.14,-3.14,65536,65537]),t=Fi(r)&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var ki="function"==typeof Uint16Array?Uint16Array:void 0,Vi=function(){throw new Error("not implemented")},zi=Ni()?ki:Vi,Gi=y,Xi="function"==typeof Int32Array;var $i="function"==typeof Int32Array?Int32Array:null,Hi=function(t){return Xi&&t instanceof Int32Array||"[object Int32Array]"===Gi(t)},Wi=$i;var qi=function(){var t,r;if("function"!=typeof Wi)return!1;try{r=new Wi([1,3.14,-3.14,2147483648]),t=Hi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t};var Ji="function"==typeof Int32Array?Int32Array:void 0,Zi=function(){throw new Error("not implemented")},Ki=qi()?Ji:Zi,Qi=y,tu="function"==typeof Uint32Array;var ru="function"==typeof Uint32Array?Uint32Array:null,nu=function(t){return tu&&t instanceof Uint32Array||"[object Uint32Array]"===Qi(t)},eu=ru;var ou=function(){var t,r;if("function"!=typeof eu)return!1;try{r=new eu(r=[1,3.14,-3.14,4294967296,4294967297]),t=nu(r)&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var iu="function"==typeof Uint32Array?Uint32Array:void 0,uu=function(){throw new Error("not implemented")},fu=ou()?iu:uu,au=y,cu="function"==typeof Float32Array;var su="function"==typeof Float32Array?Float32Array:null,lu=function(t){return cu&&t instanceof Float32Array||"[object Float32Array]"===au(t)},hu=Ar,pu=su;var yu=function(){var t,r;if("function"!=typeof pu)return!1;try{r=new pu([1,3.14,-3.14,5e40]),t=lu(r)&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===hu}catch(r){t=!1}return t};var vu="function"==typeof Float32Array?Float32Array:void 0,gu=function(){throw new Error("not implemented")},wu=yu()?vu:gu,du=y,bu="function"==typeof Float64Array;var mu="function"==typeof Float64Array?Float64Array:null,Au=function(t){return bu&&t instanceof Float64Array||"[object Float64Array]"===du(t)},Eu=mu;var _u=function(){var t,r;if("function"!=typeof Eu)return!1;try{r=new Eu([1,3.14,-3.14,NaN]),t=Au(r)&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t};var Ou,Pu="function"==typeof Float64Array?Float64Array:void 0,ju=function(){throw new Error("not implemented")};Ou=_u()?Pu:ju;var Ru=fi,Tu=gi,Uu=Pi,Iu=xi,Su=zi,Bu=Ki,Yu=fu,xu=wu,Cu=Ou;function Mu(t){return new Ru(t)}function Lu(t){return new Tu(t)}function Fu(t){return new Uu(t)}function Du(t){return new Iu(t)}function Nu(t){return new Su(t)}function ku(t){return new Bu(t)}function Vu(t){return new Yu(t)}function zu(t){return new xu(t)}function Gu(t){return new Cu(t)}var Xu=f,$u=Ct,Hu=Nt,Wu=cn,qu=qt,Ju=yn,Zu=xn,Ku=Ye,Qu=Le,tf=ke,rf=un,nf=C,ef=oi,of={int8array:Mu,uint8array:Lu,uint8clampedarray:Fu,int16array:Du,uint16array:Nu,int32array:ku,uint32array:Vu,float32array:zu,float64array:Gu};function uf(t,r,n,e,o){var i,u,f,a,c,s,l,h,p,y;if(o-=1,"object"!=typeof t||null===t)return t;if(Hu(t))return ef(t);if(Wu(t))return function(t){var r,n,e,o,i,u,f=[],a=[];for(i=new t.constructor(t.message),f.push(t),a.push(i),t.stack&&(i.stack=t.stack),t.code&&(i.code=t.code),t.errno&&(i.errno=t.errno),t.syscall&&(i.syscall=t.syscall),r=Ku(t),u=0;u0)for(i=f,y=0;y1){if(!af(r))throw new TypeError("invalid argument. `level` must be a nonnegative integer. Value: `"+r+"`.");if(0===r)return t}else r=cf;return n=ff(t)?new Array(t.length):{},sf(t,n,[t],[n],r)},hf=lf,pf=Ct;var yf=function(t){return"object"==typeof t&&null!==t&&!pf(t)},vf=Zt,gf=un,wf=f,df=y,bf=Object.prototype;var mf=function(t){var r;return!!yf(t)&&(!(r=gf(t))||!wf(t,"constructor")&&wf(r,"constructor")&&vf(r.constructor)&&"[object Function]"===df(r.constructor)&&wf(r,"isPrototypeOf")&&vf(r.isPrototypeOf)&&(r===bf||function(t){var r;for(r in t)if(!wf(t,r))return!1;return!0}(t)))},Af=mf,Ef=f,_f=J.isPrimitive;var Of={url:"https://stdlib.io/docs/api/latest/error-decoder.html",message:"Minified stdlib error code: {{code}}. Visit {{url}} for the full message."},Pf=ur,jf=hf,Rf=function(t,r){return Af(r)?Ef(r,"url")&&(t.url=r.url,!_f(t.url))?new TypeError("invalid option. `url` option must be a string primitive. Option: `"+t.url+"`."):Ef(r,"message")&&(t.message=r.message,!_f(t.message))?new TypeError("invalid option. `message` option must be a string primitive. Option: `"+t.message+"`."):null:new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.")},Tf=Of;var Uf=function(t){var r,n;if(r=jf(Tf),n=Rf(r,t))throw n;return function(){var t,n,e=arguments[0],o=r.url+"?code="+e;for(n=1;n\n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasSymbols = require( '@stdlib/assert-has-symbol-support' );\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `toStringTag` support.\n*\n* @module @stdlib/assert-has-tostringtag-support\n*\n* @example\n* var hasToStringTagSupport = require( '@stdlib/assert-has-tostringtag-support' );\n*\n* var bool = hasToStringTagSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasToStringTagSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nmodule.exports = toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object has a specified property.\n*\n* @module @stdlib/assert-has-own-property\n*\n* @example\n* var hasOwnProp = require( '@stdlib/assert-has-own-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* bool = hasOwnProp( beep, 'bop' );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasOwnProp = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nmodule.exports = toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar toStringTag = require( './tostringtag.js' );\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* var nativeClass = require( '@stdlib/utils-native-class' );\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar builtin = require( './native_class.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt8Array = require( '@stdlib/assert-is-int8array' );\nvar INT8_MAX = require( '@stdlib/constants-int8-max' );\nvar INT8_MIN = require( '@stdlib/constants-int8-min' );\nvar GlobalInt8Array = require( './int8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* var INT8_MIN = require( '@stdlib/constants-int8-min' );\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int8Array` support.\n*\n* @module @stdlib/assert-has-int8array-support\n*\n* @example\n* var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\n*\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MODULES //\n\nvar defineProperty = require( './define_property.js' );\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nvar main = ( typeof Object.defineProperty === 'function' ) ? Object.defineProperty : null;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 no-underscore-dangle, no-proto */\n\n'use strict';\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an object. Value: `' + obj + '`.' );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. Property descriptor must be an object. Value: `' + descriptor + '`.' );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* var defineProperty = require( '@stdlib/utils-define-property' );\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nvar hasDefinePropertySupport = require( './has_define_property_support.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar defineProperty = require( '@stdlib/utils-define-property' );\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define a non-enumerable read-only property.\n*\n* @module @stdlib/utils-define-nonenumerable-read-only-property\n*\n* @example\n* var setNonEnumerableReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\n\n// MODULES //\n\nvar setNonEnumerableReadOnly = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar valueOf = require( './valueof.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2valueof.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' );\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isObject;\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isString = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isString, 'isPrimitive', isPrimitive );\nsetReadOnly( isString, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string primitive\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Escape a regular expression string or pattern.\n*\n* @module @stdlib/utils-escape-regexp-string\n*\n* @example\n* var rescape = require( '@stdlib/utils-escape-regexp-string' );\n*\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\n\n// MODULES //\n\nvar rescape = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar RE = /./;\n\n\n// EXPORTS //\n\nmodule.exports = RE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* var isBoolean = require( '@stdlib/assert-is-boolean' );\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* // Use interface to check for boolean primitives...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* // Use interface to check for boolean objects...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isObject;\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isBoolean = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isBoolean, 'isPrimitive', isPrimitive );\nsetReadOnly( isBoolean, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof global === 'object' ) ? global : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar getThis = require( './codegen.js' );\nvar Self = require( './self.js' );\nvar Win = require( './window.js' );\nvar Global = require( './global.js' );\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. Must provide a boolean primitive. Value: `'+codegen+'`.' );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: Node.js\n\tif ( Global ) {\n\t\treturn Global;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getGlobal = require( '@stdlib/utils-global' );\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nmodule.exports = nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the global object.\n*\n* @module @stdlib/utils-global\n*\n* @example\n* var getGlobal = require( '@stdlib/utils-global' );\n*\n* var g = getGlobal();\n* // returns {...}\n*/\n\n// MODULES //\n\nvar getGlobal = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar RE = require( './fixtures/re.js' );\nvar nodeList = require( './fixtures/nodelist.js' );\nvar typedarray = require( './fixtures/typedarray.js' );\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* var reFunctionName = require( '@stdlib/regexp-function-name' );\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reFunctionName = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reFunctionName, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar reFunctionName = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nmodule.exports = RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nmodule.exports = f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an array.\n*\n* @module @stdlib/assert-is-array\n*\n* @example\n* var isArray = require( '@stdlib/assert-is-array' );\n*\n* var bool = isArray( [] );\n* // returns true\n*\n* bool = isArray( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isArray = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* var isOdd = require( '@stdlib/assert-is-odd' );\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a function. Value: `' + predicate + '`.' );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' );\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' ).isObjectLikeArray;\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar arrayfun = require( '@stdlib/assert-tools-array-function' );\nvar isObjectLike = require( './main.js' );\n\n\n// MAIN //\n\nsetReadOnly( isObjectLike, 'isObjectLikeArray', arrayfun( isObjectLike ) );\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObjectLike = require( '@stdlib/assert-is-object-like' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a Buffer instance.\n*\n* @module @stdlib/assert-is-buffer\n*\n* @example\n* var isBuffer = require( '@stdlib/assert-is-buffer' );\n*\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* v = isBuffer( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isBuffer = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar RE = require( '@stdlib/regexp-function-name' ).REGEXP;\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine the name of a value's constructor.\n*\n* @module @stdlib/utils-constructor-name\n*\n* @example\n* var constructorName = require( '@stdlib/utils-constructor-name' );\n*\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* v = constructorName( {} );\n* // returns 'Object'\n*\n* v = constructorName( true );\n* // returns 'Boolean'\n*/\n\n// MODULES //\n\nvar constructorName = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* var typeOf = require( '@stdlib/utils-type-of' );\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nvar usePolyfill = require( './check.js' );\nvar typeOf = require( './typeof.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : typeOf;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar typeOf = require( '@stdlib/utils-type-of' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a function.\n*\n* @module @stdlib/assert-is-function\n*\n* @example\n* var isFunction = require( '@stdlib/assert-is-function' );\n*\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\n\n// MODULES //\n\nvar isFunction = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar exec = require( './exec.js' );\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2exec.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar rescape = require( '@stdlib/utils-escape-regexp-string' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isRegExp = require( '@stdlib/assert-is-regexp' );\n\n\n// MAIN //\n\n/**\n* Replace search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string primitive\n* @throws {TypeError} second argument argument must be a string primitive or regular expression\n* @throws {TypeError} third argument must be a string primitive or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* var capitalize = require( '@stdlib/string-capitalize' );\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer);\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be a string primitive. Value: `' + str + '`.' );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = rescape( search );\n\t\tsearch = new RegExp( search, 'g' );\n\t}\n\telse if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( 'invalid argument. Second argument must be a string primitive or regular expression. Value: `' + search + '`.' );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( 'invalid argument. Third argument must be a string primitive or replacement function. Value: `' + newval + '`.' );\n\t}\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Replace search occurrences with a replacement string.\n*\n* @module @stdlib/string-replace\n*\n* @example\n* var replace = require( '@stdlib/string-replace' );\n*\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* str = 'Hello World';\n* out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*/\n\n// MODULES //\n\nvar replace = require( './replace.js' );\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Constructor which returns a `Number` object.\n*\n* @module @stdlib/number-ctor\n*\n* @example\n* var Number = require( '@stdlib/number-ctor' );\n*\n* var v = new Number( 10.0 );\n* // returns \n*/\n\n// MODULES //\n\nvar Number = require( './number.js' );\n\n\n// EXPORTS //\n\nmodule.exports = Number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// EXPORTS //\n\nmodule.exports = Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar Number = require( '@stdlib/number-ctor' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' );\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isObject;\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNumber = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNumber, 'isPrimitive', isPrimitive );\nsetReadOnly( isNumber, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* var FLOAT64_PINF = require( '@stdlib/constants-float64-pinf' );\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* var FLOAT64_NINF = require( '@stdlib/constants-float64-ninf' );\n* // returns -Infinity\n*/\n\n// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar floor = require( '@stdlib/math-base-special-floor' );\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nmodule.exports = floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a finite double-precision floating-point number is an integer.\n*\n* @module @stdlib/math-base-assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/math-base-assert-is-integer' );\n*\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* bool = isInteger( 3.14 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isInteger = require( './is_integer.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar isInt = require( '@stdlib/math-base-assert-is-integer' );\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/assert-is-integer' );\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' );\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isObject;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNonNegativeInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNonNegativeInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isNonNegativeInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar getProto = require( './proto.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar builtin = require( './native.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getProto = require( './detect.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the prototype of a provided object.\n*\n* @module @stdlib/utils-get-prototype-of\n*\n* @example\n* var getPrototype = require( '@stdlib/utils-get-prototype-of' );\n*\n* var proto = getPrototype( {} );\n* // returns {}\n*/\n\n// MODULES //\n\nvar getPrototype = require( './get_prototype_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an `Error` object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `Error` object\n*\n* @example\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isError( {} );\n* // returns false\n*/\nfunction isError( value ) {\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tif ( value instanceof Error ) {\n\t\treturn true;\n\t}\n\t// Walk the prototype tree until we find an object having the desired native class...\n\twhile ( value ) {\n\t\tif ( nativeClass( value ) === '[object Error]' ) {\n\t\t\treturn true;\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `Error` object.\n*\n* @module @stdlib/assert-is-error\n*\n* @example\n* var isError = require( '@stdlib/assert-is-error' );\n*\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* bool = isError( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isError = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 a regular expression to parse a regular expression string.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*/\nfunction reRegExp() {\n\treturn /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/; // eslint-disable-line no-useless-escape\n}\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 regular expression to parse a regular expression string.\n*\n* @module @stdlib/regexp-regexp\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var parts = RE_REGEXP.exec( '/^.*$/ig' );\n* // returns [ '/^.*$/ig', '^.*$', 'ig', 'index': 0, 'input': '/^.*$/ig' ]\n*/\n\n// MAIN //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reRegExp = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reRegExp, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar reRegExp = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Matches parts of a regular expression string.\n*\n* Regular expression: `/^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/`\n*\n* - `/^\\/`\n* - match a string that begins with a `/`\n*\n* - `()`\n* - capture\n*\n* - `(?:)+`\n* - capture, but do not remember, a group of characters which occur one or more times\n*\n* - `\\\\\\/`\n* - match the literal `\\/`\n*\n* - `|`\n* - OR\n*\n* - `[^\\/]`\n* - anything which is not the literal `\\/`\n*\n* - `\\/`\n* - match the literal `/`\n*\n* - `([imgy]*)`\n* - capture any characters matching `imgy` occurring zero or more times\n*\n* - `$/`\n* - string end\n*\n*\n* @constant\n* @type {RegExp}\n* @default /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/\n*/\nvar RE_REGEXP = reRegExp();\n\n\n// EXPORTS //\n\nmodule.exports = RE_REGEXP;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar reRegExp = require( '@stdlib/regexp-regexp' );\n\n\n// MAIN //\n\n/**\n* Parses a regular expression string and returns a new regular expression.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} must provide a regular expression string\n* @returns {(RegExp|null)} regular expression or null\n*\n* @example\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\nfunction reFromString( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Capture the regular expression pattern and any flags:\n\tstr = reRegExp().exec( str );\n\n\t// Create a new regular expression:\n\treturn ( str ) ? new RegExp( str[1], str[2] ) : null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Create a regular expression from a regular expression string.\n*\n* @module @stdlib/utils-regexp-from-string\n*\n* @example\n* var reFromString = require( '@stdlib/utils-regexp-from-string' );\n*\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\n\n// MODULES //\n\nvar reFromString = require( './from_string.js' );\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a double-precision floating-point numeric value is `NaN`.\n*\n* @module @stdlib/math-base-assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/math-base-assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 7.0 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isnan = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is `NaN`.\n*\n* @module @stdlib/assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isObject;\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isnan = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isnan, 'isPrimitive', isPrimitive );\nsetReadOnly( isnan, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isCollection;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isnan = require( '@stdlib/assert-is-nan' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} `fromIndex` must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array-like object. Value: `' + arr + '`.' );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `fromIndex` must be an integer. Value: `' + fromIndex + '`.' );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* var MAX_TYPED_ARRAY_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nmodule.exports = MAX_TYPED_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the first index at which a given element can be found.\n*\n* @module @stdlib/utils-index-of\n*\n* @example\n* var indexOf = require( '@stdlib/utils-index-of' );\n*\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* arr = [ 4, 3, 2, 1 ];\n* idx = indexOf( arr, 5 );\n* // returns -1\n*\n* // Using a `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* // `fromIndex` which exceeds `array` length:\n* arr = [ 1, 2, 3, 4, 2, 5 ];\n* idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* // Negative `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* // Negative `fromIndex` exceeding input `array` length:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* // Array-like objects:\n* var str = 'bebop';\n* idx = indexOf( str, 'o' );\n* // returns 3\n*/\n\n// MODULES //\n\nvar indexOf = require( './index_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar keys = require( './builtin.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.keys !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArguments = require( './main.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnum = require( './native.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' );\nvar isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isEnum = require( './native.js' );\nvar hasStringEnumBug = require( './has_string_enumerability_bug.js' );\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object's own property is enumerable.\n*\n* @module @stdlib/assert-is-enumerable-property\n*\n* @example\n* var isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\n\n// MODULES //\n\nvar isEnumerableProperty = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-uint32-max' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* var isArguments = require( '@stdlib/assert-is-arguments' );\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasArgumentsClass = require( './detect.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar builtin = require( './builtin.js' );\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nmodule.exports = noop;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar noop = require( '@stdlib/utils-noop' );\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isConstructorPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar EXCLUDED_KEYS = require( './excluded_keys.json' );\nvar win = require( './window.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nmodule.exports = w;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof window !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasAutomationEqualityBug = require( './has_automation_equality_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar HAS_WINDOW = require( './has_window.js' );\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = wrapper;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObjectLike = require( '@stdlib/assert-is-object-like' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar HAS_ENUM_PROTO_BUG = require( './has_enumerable_prototype_bug.js' );\nvar HAS_NON_ENUM_PROPS_BUG = require( './has_non_enumerable_properties_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype_wrapper.js' );\nvar NON_ENUMERABLE = require( './non_enumerable.json' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasArgumentsBug = require( './has_arguments_bug.js' );\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar wrapper = require( './builtin_wrapper.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an array of an object's own enumerable property names.\n*\n* @module @stdlib/utils-keys\n*\n* @example\n* var keys = require( '@stdlib/utils-keys' );\n*\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\n\n// MODULES //\n\nvar keys = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.getOwnPropertyNames !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyNames = Object.getOwnPropertyNames;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn propertyNames( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar keys = require( '@stdlib/utils-keys' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n* - In environments lacking support for `Object.getOwnPropertyNames()`, property descriptors are unavailable, and thus all properties can be safely assumed to be enumerable. Hence, we can defer to calling `Object.keys`, which retrieves all own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an array of an object's own enumerable and non-enumerable property names.\n*\n* @module @stdlib/utils-property-names\n*\n* @example\n* var getOwnPropertyNames = require( '@stdlib/utils-property-names' );\n*\n* var keys = getOwnPropertyNames({\n* 'foo': 'bar',\n* 'beep': 'boop'\n* });\n* // e.g., returns [ 'foo', 'beep' ]\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.getOwnPropertyDescriptor !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyDescriptor = Object.getOwnPropertyDescriptor;\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tvar desc;\n\tif ( value === null || value === void 0 ) {\n\t\treturn null;\n\t}\n\tdesc = propertyDescriptor( value, property );\n\treturn ( desc === void 0 ) ? null : desc;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n* - In environments lacking `Object.getOwnPropertyDescriptor()` support, property descriptors do not exist. In non-supporting environment, if an object has a provided property, this function returns a descriptor object equivalent to that returned in a supporting environment; otherwise, the function returns `null`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tif ( hasOwnProp( value, property ) ) {\n\t\treturn {\n\t\t\t'configurable': true,\n\t\t\t'enumerable': true,\n\t\t\t'writable': true,\n\t\t\t'value': value[ property ]\n\t\t};\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 property descriptor for an object's own property.\n*\n* @module @stdlib/utils-property-descriptor\n*\n* @example\n* var getOwnPropertyDescriptor = require( '@stdlib/utils-property-descriptor' );\n*\n* var obj = {\n* 'foo': 'bar',\n* 'beep': 'boop'\n* };\n*\n* var keys = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':'bar'}\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Buffer === 'function' ) ? Buffer : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar GlobalBuffer = require( './buffer.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Buffer` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Buffer` support\n*\n* @example\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\nfunction hasNodeBufferSupport() {\n\tvar bool;\n\tvar b;\n\n\tif ( typeof GlobalBuffer !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tif ( typeof GlobalBuffer.from === 'function' ) {\n\t\t\tb = GlobalBuffer.from( [ 1, 2, 3, 4 ] );\n\t\t} else {\n\t\t\tb = new GlobalBuffer( [ 1, 2, 3, 4 ] ); // Note: this is deprecated behavior starting in Node v6 (see https://nodejs.org/api/buffer.html#buffer_new_buffer_array)\n\t\t}\n\t\tbool = (\n\t\t\tisBuffer( b ) &&\n\t\t\tb[ 0 ] === 1 &&\n\t\t\tb[ 1 ] === 2 &&\n\t\t\tb[ 2 ] === 3 &&\n\t\t\tb[ 3 ] === 4\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasNodeBufferSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Buffer` support.\n*\n* @module @stdlib/assert-has-node-buffer-support\n*\n* @example\n* var hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\n*\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasNodeBufferSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write (browser) polyfill\n\n// MAIN //\n\n/**\n* Buffer constructor.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Buffer constructor.\n*\n* @module @stdlib/buffer-ctor\n*\n* @example\n* var ctor = require( '@stdlib/buffer-ctor' );\n*\n* var b = new ctor( [ 1, 2, 3, 4 ] );\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\nvar main = require( './buffer.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasNodeBufferSupport() ) {\n\tctor = main;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = require( 'buffer' ).Buffer; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn Buffer.from( buffer );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn new Buffer( buffer ); // eslint-disable-line no-buffer-constructor\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy buffer data to a new `Buffer` instance.\n*\n* @module @stdlib/buffer-from-buffer\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n* var copyBuffer = require( '@stdlib/buffer-from-buffer' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = copyBuffer( b1 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFrom = require( './has_from.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar copyBuffer;\nif ( hasFrom ) {\n\tcopyBuffer = main;\n} else {\n\tcopyBuffer = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = copyBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './int8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint8Array = require( '@stdlib/assert-is-uint8array' );\nvar UINT8_MAX = require( '@stdlib/constants-uint8-max' );\nvar GlobalUint8Array = require( './uint8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\nvar builtin = require( './uint8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8Array` support.\n*\n* @module @stdlib/assert-has-uint8array-support\n*\n* @example\n* var hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\n*\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8ClampedArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint8ClampedArray = require( '@stdlib/assert-is-uint8clampedarray' );\nvar GlobalUint8ClampedArray = require( './uint8clampedarray.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @module @stdlib/array-uint8c\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8c' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' ); // eslint-disable-line id-length\nvar builtin = require( './uint8clampedarray.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8ClampedArray` support.\n*\n* @module @stdlib/assert-has-uint8clampedarray-support\n*\n* @example\n* var hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' );\n*\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt16Array = require( '@stdlib/assert-is-int16array' );\nvar INT16_MAX = require( '@stdlib/constants-int16-max' );\nvar INT16_MIN = require( '@stdlib/constants-int16-min' );\nvar GlobalInt16Array = require( './int16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-min\n* @type {integer32}\n*\n* @example\n* var INT16_MIN = require( '@stdlib/constants-int16-min' );\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT16_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int16\n*\n* @example\n* var ctor = require( '@stdlib/array-int16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\nvar builtin = require( './int16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int16Array === 'function' ) ? Int16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int16Array` support.\n*\n* @module @stdlib/assert-has-int16array-support\n*\n* @example\n* var hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\n*\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint16Array = require( '@stdlib/assert-is-uint16array' );\nvar UINT16_MAX = require( '@stdlib/constants-uint16-max' );\nvar GlobalUint16Array = require( './uint16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 16-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint16\n*\n* @example\n* var ctor = require( '@stdlib/array-uint16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\nvar builtin = require( './uint16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint16Array === 'function' ) ? Uint16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint16Array` support.\n*\n* @module @stdlib/assert-has-uint16array-support\n*\n* @example\n* var hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\n*\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt32Array = require( '@stdlib/assert-is-int32array' );\nvar INT32_MAX = require( '@stdlib/constants-int32-max' );\nvar INT32_MIN = require( '@stdlib/constants-int32-min' );\nvar GlobalInt32Array = require( './int32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-min\n* @type {integer32}\n*\n* @example\n* var INT32_MIN = require( '@stdlib/constants-int32-min' );\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT32_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int32\n*\n* @example\n* var ctor = require( '@stdlib/array-int32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\nvar builtin = require( './int32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int32Array === 'function' ) ? Int32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int32Array` support.\n*\n* @module @stdlib/assert-has-int32array-support\n*\n* @example\n* var hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\n*\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint32Array = require( '@stdlib/assert-is-uint32array' );\nvar UINT32_MAX = require( '@stdlib/constants-uint32-max' );\nvar GlobalUint32Array = require( './uint32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 32-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint32\n*\n* @example\n* var ctor = require( '@stdlib/array-uint32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\nvar builtin = require( './uint32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint32Array === 'function' ) ? Uint32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint32Array` support.\n*\n* @module @stdlib/assert-has-uint32array-support\n*\n* @example\n* var hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\n*\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFloat32Array = require( '@stdlib/assert-is-float32array' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar GlobalFloat32Array = require( './float32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of single-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float32\n*\n* @example\n* var ctor = require( '@stdlib/array-float32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\nvar builtin = require( './float32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Float32Array === 'function' ) ? Float32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float32Array` support.\n*\n* @module @stdlib/assert-has-float32array-support\n*\n* @example\n* var hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\n*\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat64Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFloat64Array = require( '@stdlib/assert-is-float64array' );\nvar GlobalFloat64Array = require( './float64array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float64\n*\n* @example\n* var ctor = require( '@stdlib/array-float64' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\nvar builtin = require( './float64array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Float64Array === 'function' ) ? Float64Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float64Array` support.\n*\n* @module @stdlib/assert-has-float64array-support\n*\n* @example\n* var hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\n*\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Int8Array = require( '@stdlib/array-int8' );\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar Uint8ClampedArray = require( '@stdlib/array-uint8c' );\nvar Int16Array = require( '@stdlib/array-int16' );\nvar Uint16Array = require( '@stdlib/array-uint16' );\nvar Int32Array = require( '@stdlib/array-int32' );\nvar Uint32Array = require( '@stdlib/array-uint32' );\nvar Float32Array = require( '@stdlib/array-float32' );\nvar Float64Array = require( '@stdlib/array-float64' );\n\n\n// VARIABLES //\n\nvar hash;\n\n\n// FUNCTIONS //\n\n/**\n* Copies an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - array to copy\n* @returns {Int8Array} new array\n*/\nfunction int8array( arr ) {\n\treturn new Int8Array( arr );\n}\n\n/**\n* Copies a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - array to copy\n* @returns {Uint8Array} new array\n*/\nfunction uint8array( arr ) {\n\treturn new Uint8Array( arr );\n}\n\n/**\n* Copies a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - array to copy\n* @returns {Uint8ClampedArray} new array\n*/\nfunction uint8clampedarray( arr ) {\n\treturn new Uint8ClampedArray( arr );\n}\n\n/**\n* Copies an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - array to copy\n* @returns {Int16Array} new array\n*/\nfunction int16array( arr ) {\n\treturn new Int16Array( arr );\n}\n\n/**\n* Copies a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - array to copy\n* @returns {Uint16Array} new array\n*/\nfunction uint16array( arr ) {\n\treturn new Uint16Array( arr );\n}\n\n/**\n* Copies an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - array to copy\n* @returns {Int32Array} new array\n*/\nfunction int32array( arr ) {\n\treturn new Int32Array( arr );\n}\n\n/**\n* Copies a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - array to copy\n* @returns {Uint32Array} new array\n*/\nfunction uint32array( arr ) {\n\treturn new Uint32Array( arr );\n}\n\n/**\n* Copies a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - array to copy\n* @returns {Float32Array} new array\n*/\nfunction float32array( arr ) {\n\treturn new Float32Array( arr );\n}\n\n/**\n* Copies a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - array to copy\n* @returns {Float64Array} new array\n*/\nfunction float64array( arr ) {\n\treturn new Float64Array( arr );\n}\n\n/**\n* Returns a hash of functions for copying typed arrays.\n*\n* @private\n* @returns {Object} function hash\n*/\nfunction typedarrays() {\n\tvar out = {\n\t\t'int8array': int8array,\n\t\t'uint8array': uint8array,\n\t\t'uint8clampedarray': uint8clampedarray,\n\t\t'int16array': int16array,\n\t\t'uint16array': uint16array,\n\t\t'int32array': int32array,\n\t\t'uint32array': uint32array,\n\t\t'float32array': float32array,\n\t\t'float64array': float64array\n\t};\n\treturn out;\n}\n\n\n// MAIN //\n\nhash = typedarrays();\n\n\n// EXPORTS //\n\nmodule.exports = hash;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar regexp = require( '@stdlib/utils-regexp-from-string' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar propertyNames = require( '@stdlib/utils-property-names' );\nvar propertyDescriptor = require( '@stdlib/utils-property-descriptor' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar defineProperty = require( '@stdlib/utils-define-property' );\nvar copyBuffer = require( '@stdlib/buffer-from-buffer' );\nvar typedArrays = require( './typed_arrays.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Clones a class instance.\n*\n* ## Notes\n*\n* - This should **only** be used for simple cases. Any instances with privileged access to variables (e.g., within closures) cannot be cloned. This approach should be considered **fragile**.\n* - The function is greedy, disregarding the notion of a `level`. Instead, the function deep copies all properties, as we assume the concept of `level` applies only to the class instance reference but not to its internal state. This prevents, in theory, two instances from sharing state.\n*\n*\n* @private\n* @param {Object} val - class instance\n* @returns {Object} new instance\n*/\nfunction cloneInstance( val ) {\n\tvar cache;\n\tvar names;\n\tvar name;\n\tvar refs;\n\tvar desc;\n\tvar tmp;\n\tvar ref;\n\tvar i;\n\n\tcache = [];\n\trefs = [];\n\n\tref = Object.create( getPrototypeOf( val ) );\n\tcache.push( val );\n\trefs.push( ref );\n\n\tnames = propertyNames( val );\n\tfor ( i = 0; i < names.length; i++ ) {\n\t\tname = names[ i ];\n\t\tdesc = propertyDescriptor( val, name );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( val[name] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( val[name], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( ref, name, desc );\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( ref );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( ref );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( ref );\n\t}\n\treturn ref;\n}\n\n/**\n* Copies an error object.\n*\n* @private\n* @param {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error - error to copy\n* @returns {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error copy\n*\n* @example\n* var err1 = new TypeError( 'beep' );\n*\n* var err2 = copyError( err1 );\n* // returns \n*/\nfunction copyError( error ) {\n\tvar cache = [];\n\tvar refs = [];\n\tvar keys;\n\tvar desc;\n\tvar tmp;\n\tvar key;\n\tvar err;\n\tvar i;\n\n\t// Create a new error...\n\terr = new error.constructor( error.message );\n\n\tcache.push( error );\n\trefs.push( err );\n\n\t// If a `stack` property is present, copy it over...\n\tif ( error.stack ) {\n\t\terr.stack = error.stack;\n\t}\n\t// Node.js specific (system errors)...\n\tif ( error.code ) {\n\t\terr.code = error.code;\n\t}\n\tif ( error.errno ) {\n\t\terr.errno = error.errno;\n\t}\n\tif ( error.syscall ) {\n\t\terr.syscall = error.syscall;\n\t}\n\t// Any enumerable properties...\n\tkeys = objectKeys( error );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tdesc = propertyDescriptor( error, key );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( error[ key ] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( error[ key ], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( err, key, desc );\n\t}\n\treturn err;\n}\n\n\n// MAIN //\n\n/**\n* Recursively performs a deep copy of an input object.\n*\n* @private\n* @param {*} val - value to copy\n* @param {(Array|Object)} copy - copy\n* @param {Array} cache - an array of visited objects\n* @param {Array} refs - an array of object references\n* @param {NonNegativeInteger} level - copy depth\n* @returns {*} deep copy\n*/\nfunction deepCopy( val, copy, cache, refs, level ) {\n\tvar parent;\n\tvar keys;\n\tvar name;\n\tvar desc;\n\tvar ctor;\n\tvar key;\n\tvar ref;\n\tvar x;\n\tvar i;\n\tvar j;\n\n\tlevel -= 1;\n\n\t// Primitives and functions...\n\tif (\n\t\ttypeof val !== 'object' ||\n\t\tval === null\n\t) {\n\t\treturn val;\n\t}\n\tif ( isBuffer( val ) ) {\n\t\treturn copyBuffer( val );\n\t}\n\tif ( isError( val ) ) {\n\t\treturn copyError( val );\n\t}\n\t// Objects...\n\tname = typeOf( val );\n\n\tif ( name === 'date' ) {\n\t\treturn new Date( +val );\n\t}\n\tif ( name === 'regexp' ) {\n\t\treturn regexp( val.toString() );\n\t}\n\tif ( name === 'set' ) {\n\t\treturn new Set( val );\n\t}\n\tif ( name === 'map' ) {\n\t\treturn new Map( val );\n\t}\n\tif (\n\t\tname === 'string' ||\n\t\tname === 'boolean' ||\n\t\tname === 'number'\n\t) {\n\t\t// If provided an `Object`, return an equivalent primitive!\n\t\treturn val.valueOf();\n\t}\n\tctor = typedArrays[ name ];\n\tif ( ctor ) {\n\t\treturn ctor( val );\n\t}\n\t// Class instances...\n\tif (\n\t\tname !== 'array' &&\n\t\tname !== 'object'\n\t) {\n\t\t// Cloning requires ES5 or higher...\n\t\tif ( typeof Object.freeze === 'function' ) {\n\t\t\treturn cloneInstance( val );\n\t\t}\n\t\treturn {};\n\t}\n\t// Arrays and plain objects...\n\tkeys = objectKeys( val );\n\tif ( level > 0 ) {\n\t\tparent = name;\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tx = val[ key ];\n\n\t\t\t// Primitive, Buffer, special class instance...\n\t\t\tname = typeOf( x );\n\t\t\tif (\n\t\t\t\ttypeof x !== 'object' ||\n\t\t\t\tx === null ||\n\t\t\t\t(\n\t\t\t\t\tname !== 'array' &&\n\t\t\t\t\tname !== 'object'\n\t\t\t\t) ||\n\t\t\t\tisBuffer( x )\n\t\t\t) {\n\t\t\t\tif ( parent === 'object' ) {\n\t\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\t\tdesc.value = deepCopy( x );\n\t\t\t\t\t}\n\t\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t\t} else {\n\t\t\t\t\tcopy[ key ] = deepCopy( x );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Circular reference...\n\t\t\ti = indexOf( cache, x );\n\t\t\tif ( i !== -1 ) {\n\t\t\t\tcopy[ key ] = refs[ i ];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Plain array or object...\n\t\t\tref = ( isArray( x ) ) ? new Array( x.length ) : {};\n\t\t\tcache.push( x );\n\t\t\trefs.push( ref );\n\t\t\tif ( parent === 'array' ) {\n\t\t\t\tcopy[ key ] = deepCopy( x, ref, cache, refs, level );\n\t\t\t} else {\n\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\tdesc.value = deepCopy( x, ref, cache, refs, level );\n\t\t\t\t}\n\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t}\n\t\t}\n\t} else if ( name === 'array' ) {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tcopy[ key ] = val[ key ];\n\t\t}\n\t} else {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\tdefineProperty( copy, key, desc );\n\t\t}\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( copy );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( copy );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( copy );\n\t}\n\treturn copy;\n}\n\n\n// EXPORTS //\n\nmodule.exports = deepCopy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar deepCopy = require( './deep_copy.js' );\n\n\n// MAIN //\n\n/**\n* Copies or deep clones a value to an arbitrary depth.\n*\n* @param {*} value - value to copy\n* @param {NonNegativeInteger} [level=+infinity] - copy depth\n* @throws {TypeError} `level` must be a nonnegative integer\n* @returns {*} value copy\n*\n* @example\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ { 'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\nfunction copy( value, level ) {\n\tvar out;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( level ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `level` must be a nonnegative integer. Value: `' + level + '`.' );\n\t\t}\n\t\tif ( level === 0 ) {\n\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tlevel = PINF;\n\t}\n\tout = ( isArray( value ) ) ? new Array( value.length ) : {};\n\treturn deepCopy( value, out, [value], [out], level );\n}\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy or deep clone a value to an arbitrary depth.\n*\n* @module @stdlib/utils-copy\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ {'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\n\n// MODULES //\n\nvar copy = require( './copy.js' );\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {(Error|null)} error object or null\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );\n\t}\n\tif ( hasOwnProp( options, 'url' ) ) {\n\t\topts.url = options.url;\n\t\tif ( !isString( opts.url ) ) {\n\t\t\treturn new TypeError( 'invalid option. `url` option must be a string primitive. Option: `' + opts.url + '`.' );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'message' ) ) {\n\t\topts.message = options.message;\n\t\tif ( !isString( opts.message ) ) {\n\t\t\treturn new TypeError( 'invalid option. `message` option must be a string primitive. Option: `' + opts.message + '`.' );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a plain object.\n*\n* @module @stdlib/assert-is-plain-object\n*\n* @example\n* var isPlainObject = require( '@stdlib/assert-is-plain-object' );\n*\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* bool = isPlainObject( null );\n* // returns false\n*/\n\n// MODULES //\n\nvar isPlainObject = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar replace = require( '@stdlib/string-replace' );\nvar copy = require( '@stdlib/utils-copy' );\nvar validate = require( './validate.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function which formats an error message for production.\n*\n* @param {Options} options - function options\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {Function} error formatting function\n*\n* @example\n* var opts = {\n* 'url': 'https://stdlib.io/error-decoder.html'\n* };\n*\n* var fcn = factory( opts );\n* // returns \n*/\nfunction factory( options ) {\n\tvar opts;\n\tvar err;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\treturn formatProdErrorMessage;\n\n\t/**\n\t* Formats an error message for production.\n\t*\n\t* @private\n\t* @param {string} code - error code\n\t* @param {*} ...args - error message arguments\n\t* @returns {string} formatted error message\n\t*/\n\tfunction formatProdErrorMessage() {\n\t\tvar code = arguments[ 0 ];\n\t\tvar url = opts.url + '?code='+code;\n\t\tvar msg;\n\t\tvar i;\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\turl += '&arg[]=' + encodeURIComponent( arguments[ i ] );\n\t\t}\n\t\tmsg = replace( opts.message, '{{url}}', url );\n\t\tmsg = replace( msg, '{{code}}', code );\n\t\treturn msg;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Format an error message for production.\n*\n* @module @stdlib/error-tools-fmtprodmsg\n*\n* @example\n* var formatProdErrorMessage = require( '@stdlib/error-tools-fmtprodmsg' );\n*\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar formatProdErrorMessage = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( formatProdErrorMessage, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar factory = require( './factory.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @name formatProdErrorMessage\n* @type {Function}\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\nvar formatProdErrorMessage = factory( defaults );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","hasSymbols","lib","toStringTag","tostring","Object","prototype","toString","toStr","require$$0","native_class","v","call","has","hasOwnProperty","value","property","toStrTag","hasOwnProp","require$$2","builtin","require$$1","polyfill","isOwn","tag","out","err","nativeClass","hasInt8Array","Int8Array","main","isInt8Array","GlobalInt8Array","bool","arr","INT8_MAX","ctor","defineProperty","has_define_property_support","objectProtoype","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","obj","prop","descriptor","hasValue","hasGet","hasSet","TypeError","__proto__","Error","get","set","configurable","enumerable","writable","primitive","valueOf","String","test","object","isPrimitive","isObject","setReadOnly","isString","require$$3","RE_CHARS","str","s","i","length","replace","substring","re","Boolean","isBoolean","codegen","Function","self_1","self","window_1","window","global","module","exports","getThis","Self","Win","Global","arguments","root","nodeList","document","childNodes","typedarray","RE","check_1","reFunctionName","Array","isArray","isObjectLike","predicate","len","arrayfun","_isBuffer","constructor","isBuffer","REGEXP","match","name","slice","exec","ctorName","typeOf","type","toLowerCase","RegExp","rescape","isFunction","isRegExp","search","newval","Number","isNumber","POSITIVE_INFINITY","NEGATIVE_INFINITY","floor","Math","x","PINF","NINF","isInt","integer","isInteger","isNonNegativeInteger","getProto","getPrototypeOf","proto","reRegExp","isNan","isnan","isCollection","index_of","searchElement","fromIndex","keys","has_arguments_bug","has_builtin","isArguments","bool$8","detect","detect_1","native","propertyIsEnumerable","bool$7","isEnum","hasStringEnumBug","isEnumerableProperty","require$$4","builtin_wrapper","has_enumerable_prototype_bug","has_non_enumerable_properties_bug","is_constructor_prototype","w","indexOf","isConstructorPrototype","EXCLUDED_KEYS","win","bool$4","k","check","hasAutomationEqualityBug","HAS_WINDOW","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","error","NON_ENUMERABLE","wrapper","skipConstructor","skipPrototype","isFcn","p","push","getOwnPropertyNames","propertyNames","getOwnPropertyDescriptor","propertyDescriptor","desc","Buffer","GlobalBuffer","b","from","buffer","hasUint8Array","Uint8Array","isUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ClampedArray","Uint8ClampedArray","isUint8ClampedArray","GlobalUint8ClampedArray","hasInt16Array","Int16Array","isInt16Array","GlobalInt16Array","INT16_MAX","hasUint16Array","Uint16Array","isUint16Array","GlobalUint16Array","UINT16_MAX","hasInt32Array","Int32Array","isInt32Array","GlobalInt32Array","INT32_MAX","hasUint32Array","Uint32Array","isUint32Array","GlobalUint32Array","UINT32_MAX","hasFloat32Array","Float32Array","isFloat32Array","GlobalFloat32Array","hasFloat64Array","Float64Array","isFloat64Array","GlobalFloat64Array","NaN","require$$5","require$$6","require$$7","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","isError","regexp","objectKeys","require$$8","require$$9","require$$10","require$$11","copyBuffer","require$$12","typedArrays","deepCopy","val","copy","cache","refs","level","parent","key","ref","j","tmp","message","stack","code","errno","syscall","copyError","Date","Set","Map","freeze","names","create","isExtensible","preventExtensions","isSealed","seal","isFrozen","cloneInstance","copy_1","objectPrototype","isPrototypeOf","ownProps","validate","opts","options","url","defaults","factory_1","msg","encodeURIComponent","formatProdErrorMessage","hasInt8ArraySupport","format"],"mappings":";+kBAyCA,ICdIA,EDIJ,WACC,MACmB,mBAAXC,QACoB,iBAApBA,OAAQ,OCPPC,GAqBV,ICTAC,EDEA,WACC,OAASH,GAAqC,iBAAvBC,OAAOG,aEf/BC,EALYC,OAAOC,UAAUC,SCAzBC,EAAQC,EAiCZ,IAAAC,EAPA,SAAsBC,GACrB,OAAOH,EAAMI,KAAMD,IC3BhBE,EAAMR,OAAOC,UAAUQ,eAyC3B,ICjBAZ,EDIA,SAAqBa,EAAOC,GAC3B,OACCD,SAKMF,EAAID,KAAMG,EAAOC,IEnCrBC,EAA+B,mBAAXjB,OAA0BA,OAAOG,YAAc,GCAnEe,EAAaT,EACbN,EDIac,ECHbT,EAAQW,EAwDZ,ICpCIC,EAAUC,EACVC,EDKJ,SAAsBX,GACrB,IAAIY,EACAC,EACAC,EAEJ,GAAKd,QACJ,OAAOH,EAAMI,KAAMD,GAEpBa,EAAMb,EAAGR,GACToB,EAAQL,EAAYP,EAAGR,GAGvB,IACCQ,EAAGR,QAAgB,EAClB,MAAQuB,GACT,OAAOlB,EAAMI,KAAMD,GASpB,OAPAc,EAAMjB,EAAMI,KAAMD,GAEbY,EACJZ,EAAGR,GAAgBqB,SAEZb,EAAGR,GAEJsB,GCdRvB,EAjBqBO,IASNa,EAEAF,EChCXO,EAAclB,EAKdmB,EAAsC,mBAAdC,UA6B5B,IClCIC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EFwBJ,SAAsBhB,GACrB,OACGa,GAAgBb,aAAiBc,WACV,uBAAzBF,EAAaZ,IExBXiB,EDEaF,ECsCjB,IAAAA,EA1BA,WACC,IAAIG,EACAC,EAEJ,GAAgC,mBAApBF,EACX,OAAO,EAGR,IACCE,EAAM,IAAIF,EAAiB,CAAE,EAAG,MAAO,KAAMG,MAC7CF,EACCF,EAAaG,IACA,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEpBR/B,EAL0BO,ECZtB2B,EAA8B,mBAAdP,UAA6BA,eAAY,ECAzDQ,ECA0C,mBAA1BhC,OAAOgC,eAAkChC,OAAOgC,eAAiB,KD4BrF,IAAAC,EAbA,WAEC,IAEC,OADAD,EAAgB,GAAI,IAAK,KAClB,EACN,MAAQX,GACT,OAAO,IEiBTN,EALqBf,OAAOgC,eC/BxBE,EAAiBlC,OAAOC,UACxBE,EAAQ+B,EAAehC,SACvBiC,EAAeD,EAAeE,iBAC9BC,EAAeH,EAAeI,iBAC9BC,EAAeL,EAAeM,iBAC9BC,EAAeP,EAAeQ,iBAuFlC,IAAAzB,EAnDA,SAAyB0B,EAAKC,EAAMC,GACnC,IAAI5C,EACA6C,EACAC,EACAC,EAEJ,GAAoB,iBAARL,GAA4B,OAARA,GAAsC,mBAAtBxC,EAAMI,KAAMoC,GAC3D,MAAM,IAAIM,UAAW,+DAAiEN,EAAM,MAE7F,GAA2B,iBAAfE,GAA0C,OAAfA,GAAoD,mBAA7B1C,EAAMI,KAAMsC,GACzE,MAAM,IAAII,UAAW,oEAAsEJ,EAAa,MAyBzG,IAvBAC,EAAa,UAAWD,KAGtBN,EAAahC,KAAMoC,EAAKC,IACxBH,EAAalC,KAAMoC,EAAKC,IAGxB3C,EAAY0C,EAAIO,UAChBP,EAAIO,UAAYhB,SAGTS,EAAKC,GACZD,EAAKC,GAASC,EAAWnC,MAGzBiC,EAAIO,UAAYjD,GAEhB0C,EAAKC,GAASC,EAAWnC,OAG3BqC,EAAW,QAASF,EACpBG,EAAW,QAASH,EAEfC,IAAcC,GAAUC,GAC5B,MAAM,IAAIG,MAAO,wHASlB,OANKJ,GAAUZ,GACdA,EAAa5B,KAAMoC,EAAKC,EAAMC,EAAWO,KAErCJ,GAAUX,GACdA,EAAa9B,KAAMoC,EAAKC,EAAMC,EAAWQ,KAEnCV,GCrEJ5B,EAAUC,EACVC,EAAWH,EAefjB,EAjB+BO,IASbW,EAEAE,EC7Bde,EAAiB5B,EAmCrB,IAAAqB,EAZA,SAAmCkB,EAAKC,EAAMlC,GAC7CsB,EAAgBW,EAAKC,EAAM,CAC1BU,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ9C,MAASA,KCJXb,EAL+BO,ECA/B,IAAAqD,EAPA,SAAmB/C,GAClB,MAA0B,iBAAVA,GCbbgD,ECDUC,OAAO1D,UAAUyD,QDyB/B,IEvBIpC,EAAcN,EACd4C,EFUJ,SAAelD,GACd,IAEC,OADAgD,EAAQnD,KAAMG,IACP,EACN,MAAQW,GACT,OAAO,IEVL3B,EAPiBU,IA0CrB,IAAAyD,EAhBA,SAAmBnD,GAClB,MAAsB,iBAAVA,IACNA,aAAiBiD,SAGjBjE,EACGkE,EAAMlD,GAEoB,oBAAzBY,EAAaZ,MClCpBoD,EAAc1D,EACd2D,EAAW/C,EA0Bf,ICSIgD,EAAc5D,EACd6D,EDjBJ,SAAmBvD,GAClB,OAASoD,EAAapD,IAAWqD,EAAUrD,ICkBxCqD,EAAWG,EAKfF,EAAaC,EAAU,cANLnD,GAOlBkD,EAAaC,EAAU,WAAYF,GAKnC,IAAAlE,EAAiBoE,EClDbA,EAAW7D,EAAsC0D,YAKjDK,EAAW,yBAqDf,ICzCAtE,EDIA,SAAkBuE,GACjB,IACIC,EACAC,EAEJ,IAAML,EAAUG,GACf,MAAM,IAAInB,UAAW,uEAAyEmB,EAAM,MAGrG,GAAkB,MAAbA,EAAK,GAGT,IAAME,EADAF,EAAIG,OACI,EAAGD,GAAK,GACH,MAAbF,EAAKE,GADcA,KAO1B,YAAW,IAANA,GAAgBA,GAAK,EAClBF,EAAII,QAASL,EAAU,SAM/BE,GAHAA,EAAID,EAAIK,UAAW,EAAGH,IAGhBE,QAASL,EAAU,QAGzBC,EAAMA,EAAK,GAAMC,EAAID,EAAIK,UAAWH,KE/CrCI,GALS,ICyBT,IAAAjB,GAPA,SAAoB/C,GACnB,MAA0B,kBAAVA,GCjBbR,GCDWyE,QAAQ1E,UAAUC,SDyBjC,IEvBIoB,GAAcN,EACd4C,GFUJ,SAAelD,GACd,IAEC,OADAR,GAASK,KAAMG,IACR,EACN,MAAQW,GACT,OAAO,IEVL3B,GAPiBU,IA0CrB,IAAAyD,GAhBA,SAAoBnD,GACnB,MAAsB,iBAAVA,IACNA,aAAiBiE,UAGjBjF,GACGkE,GAAMlD,GAEoB,qBAAzBY,GAAaZ,MClCpBoD,GAAc1D,GACd2D,GAAW/C,GAkCf,ICAIgD,GAAc5D,EACdwE,GDRJ,SAAoBlE,GACnB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICSxCqD,GAAWG,GAKfF,GAAaY,GAAW,cANN9D,IAOlBkD,GAAaY,GAAW,WAAYb,IAKpC,IAAAlE,GAAiB+E,GCpCjB,IAAAC,GAPA,WACC,OAAO,IAAIC,SAAU,eAAd,ICFRC,GAL4B,iBAATC,KAAsBA,KAAO,KCKhDC,GAL8B,iBAAXC,OAAwBA,OAAS,6GCAhDvC,GAA0B,iBAAXwC,GAAwBA,GAAS,KAKpDC,OAAOC,QAAU1C,OCLbiC,GAAYxE,GAAuC0D,YACnDwB,GAAUtE,GACVuE,GAAOzE,GACP0E,GAAMtB,GACNuB,sCAkDJ,IAAAhE,GA7BA,SAAoBoD,GACnB,GAAKa,UAAUnB,OAAS,CACvB,IAAMK,GAAWC,GAChB,MAAM,IAAI5B,UAAW,+DAA+D4B,EAAQ,MAE7F,GAAKA,EACJ,OAAOS,KAKT,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,MAAM,IAAItC,MAAO,uDC3CdwC,GCOYvF,KDNZwF,GAAWD,GAAKE,UAAYF,GAAKE,SAASC,WER1CC,GAAavE,UCEbwE,GAAK5F,GACLwF,GHUaA,GGTbG,GDCaA,GC6BjB,IAAAE,GAnBA,WACC,MAEe,mBAAPD,IAGe,iBAAfD,IAGa,mBAAbH,ICST,IAAAnE,GAPA,WACC,MAAO,2BCEJyE,GAAiBlF,GADHZ,EAOL8F,GAAgB,SCjCR9F,MDsCrB,IAAAP,GAAiBqG,GEtCb5E,GAAclB,EAwClB,ICpBAP,GDWKsG,MAAMC,QACND,MAAMC,QARX,SAAkB1F,GACjB,MAAkC,mBAAzBY,GAAaZ,IEzBnB0F,GAAUhG,GC0Bd,ICGIiG,GDbJ,SAAuB3F,GACtB,OACW,OAAVA,GACiB,iBAAVA,GCQSN,EAOLiG,GAAc,oBFR3B,SAAmBC,GAClB,GAA0B,mBAAdA,EACX,MAAM,IAAIrD,UAAW,sDAAwDqD,EAAY,MAE1F,OASA,SAAgB5F,GACf,IAAI6F,EACAjC,EACJ,IAAM8B,GAAS1F,GACd,OAAO,EAGR,GAAa,KADb6F,EAAM7F,EAAM6D,QAEX,OAAO,EAER,IAAMD,EAAI,EAAGA,EAAIiC,EAAKjC,IACrB,IAAiC,IAA5BgC,EAAW5F,EAAO4D,IACtB,OAAO,EAGT,OAAO,GEpBuCkC,CAAUH,KAK1D,IAAAxG,GAAiBwG,GCvCbA,GAAejG,GA+CnB,IC3BAP,GDOA,SAAmBa,GAClB,OACC2F,GAAc3F,KAGbA,EAAM+F,WAEL/F,EAAMgG,aAGgC,mBAA/BhG,EAAMgG,YAAYC,UACzBjG,EAAMgG,YAAYC,SAAUjG,KEtC5BY,GAAclB,EACd4F,GAAKhF,GAA0C4F,OAC/CD,GAAW7F,GAuDf,IAAAW,GAxBA,SAA0BnB,GACzB,IAAIuG,EACAC,EACA/E,EAEJ,IAAe,YADf+E,EAAOxF,GAAahB,GAAIyG,MAAO,GAAI,KACC,UAATD,IAAqBxG,EAAEoG,YAAc,CAE/D,GAA0B,iBAD1B3E,EAAOzB,EAAEoG,aACQI,KAChB,OAAO/E,EAAK+E,KAGb,GADAD,EAAQb,GAAGgB,KAAMjF,EAAK7B,YAErB,OAAO2G,EAAO,GAGhB,OAAKF,GAAUrG,GACP,SAEDwG,GCnDJG,GCkBkB7G,GDmCtB,IErDI6G,GDkBkB7G,GCAtB,ICFI8G,GHkBJ,SAAiB5G,GAChB,IAAI6G,EAGJ,OAAW,OAAN7G,EACG,OAKM,YAHd6G,SAAc7G,GAIN2G,GAAU3G,GAAI8G,cAEfD,GG9BJlG,GDNJ,SAAiBX,GAChB,OAAO2G,GAAU3G,GAAI8G,eCetBvH,GAZkBO,KAOaa,GAAWiG,GCtBtCA,GAAS9G,GA2Bb,ICNAP,GDFA,SAAqBa,GAEpB,MAA6B,aAApBwG,GAAQxG,IErBdsG,GCFOK,OAAOpH,UAAU+G,KD0B5B,IEvBI1F,GAAcN,EACd4C,GFUJ,SAAelD,GACd,IAEC,OADAsG,GAAKzG,KAAMG,IACJ,EACN,MAAQW,GACT,OAAO,IEVL3B,GAPiBU,IA0CrB,IC1CIkH,GAAUlH,EACVmH,GAAavG,GACbiD,GAAWnD,EAAsCgD,YACjD0D,GDuBJ,SAAmB9G,GAClB,MAAsB,iBAAVA,IACNA,aAAiB2G,SAGjB3H,GACGkE,GAAMlD,GAEoB,oBAAzBY,GAAaZ,MC2BxB,ICvCAb,GDmBA,SAAkBuE,EAAKqD,EAAQC,GAC9B,IAAMzD,GAAUG,GACf,MAAM,IAAInB,UAAW,wEAA0EmB,EAAM,MAEtG,GAAKH,GAAUwD,GACdA,EAASH,GAASG,GAClBA,EAAS,IAAIJ,OAAQI,EAAQ,UAEzB,IAAMD,GAAUC,GACpB,MAAM,IAAIxE,UAAW,+FAAiGwE,EAAS,MAEhI,IAAMxD,GAAUyD,KAAaH,GAAYG,GACxC,MAAM,IAAIzE,UAAW,gGAAkGyE,EAAS,MAEjI,OAAOtD,EAAII,QAASiD,EAAQC,IEhC7B,IAAAjE,GAPA,SAAmB/C,GAClB,MAA0B,iBAAVA,GCAjBb,GCjBiB8H,OCAbzH,GCASE,GAMSH,UAAUC,SDkBhC,IEvBIoB,GAAcN,EACd2G,GAAS7G,GACT8C,GFSJ,SAAelD,GACd,IAEC,OADAR,GAASK,KAAMG,IACR,EACN,MAAQW,GACT,OAAO,IETL3B,GARiBU,IA2CrB,IAAAyD,GAhBA,SAAmBnD,GAClB,MAAsB,iBAAVA,IACNA,aAAiBiH,KAGjBjI,GACGkE,GAAMlD,GAEoB,oBAAzBY,GAAaZ,MCnCpBoD,GAAc1D,GACd2D,GAAW/C,GAkCf,ICOIgD,GAAc5D,EACdwH,GDfJ,SAAmBlH,GAClB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICgBxCqD,GAAWG,GAKfF,GAAa4D,GAAU,cANL9G,IAOlBkD,GAAa4D,GAAU,WAAY7D,IAKnC,IAAAlE,GAAiB+H,GCvBjB/H,GALmB8H,OAAOE,kBCS1BhI,GA1BaO,GAqBa0H,kBChCtBC,GCsBQC,KAAKD,MDIjB,IENAlI,GFDA,SAAoBoI,GACnB,OAAQF,GAAME,KAAOA,GGpBlBC,GAAO9H,GACP+H,GAAOnH,GACPoH,GAAQtH,GAuBZ,IAAAuH,GAXA,SAAoB3H,GACnB,OACCA,EAAQwH,IACRxH,EAAQyH,IACRC,GAAO1H,IClBLkH,GAAWxH,GAAsC0D,YACjDsE,GAAQpH,GA6BZ,IAAAyC,GAVA,SAAoB/C,GACnB,OACCkH,GAAUlH,IACV0H,GAAO1H,ICvBLkH,GAAWxH,GAAsC2D,SACjDqE,GAAQpH,GA6BZ,IAAA6C,GAVA,SAAoBnD,GACnB,OACCkH,GAAUlH,IACV0H,GAAO1H,EAAMgD,YCvBXI,GAAc1D,GACd2D,GAAW/C,GAkCf,ICMIgD,GAAc5D,EACdkI,GDdJ,SAAoB5H,GACnB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICexCqD,GAAWG,GAKfF,GAAasE,GAAW,cANNxH,IAOlBkD,GAAasE,GAAW,WAAYvE,IAKpC,IAAAlE,GAAiByI,GCvDbA,GAAYlI,GAAuC0D,YA6BvD,IAAAL,GAVA,SAA+B/C,GAC9B,OACC4H,GAAW5H,IACXA,GAAS,GCtBP4H,GAAYlI,GAAuC2D,SA6BvD,IAAAF,GAVA,SAA+BnD,GAC9B,OACC4H,GAAW5H,IACXA,EAAMgD,WAAa,GCtBjBI,GAAc1D,GACd2D,GAAW/C,GAsCf,ICGIgD,GAAc5D,EACdmI,GDXJ,SAA+B7H,GAC9B,OAASoD,GAAapD,IAAWqD,GAAUrD,ICYxCqD,GAAWG,GAKfF,GAAauE,GAAsB,cANjBzH,IAOlBkD,GAAauE,GAAsB,WAAYxE,IAK/C,IAAAlE,GAAiB0I,GCxDbC,GAAWxI,OAAOyI,eCatB,IAAAC,GARA,SAAmB/F,GAElB,OAAOA,EAAIO,WCPR5B,GAAclB,EACdoI,GAAWxH,GA+Bf,IAAAC,GAnBA,SAAyB0B,GACxB,IAAI+F,EAAQF,GAAU7F,GACtB,OAAK+F,GAAmB,OAAVA,EACNA,EAEgC,sBAAnCpH,GAAaqB,EAAI+D,aAEd/D,EAAI+D,YAAYzG,UAEnB0C,aAAe3C,OACZA,OAAOC,UAGR,MCzBJc,GHIayH,GGHbvH,GAAWH,GCFX0H,GDAapI,GAQAJ,OAAOyI,gBACZ1H,GAEAE,GCoBZ,ICdApB,GDFA,SAAyBa,GACxB,OACCA,QAGO,MAGRA,EAAQV,OAAQU,GAET8H,GAAU9H,KEzBd+H,GAAiBrI,GACjBkB,GAAcN,EAwClB,ICrBAnB,GDAA,SAAkBa,GACjB,GAAsB,iBAAVA,GAAgC,OAAVA,EACjC,OAAO,EAGR,GAAKA,aAAiByC,MACrB,OAAO,EAGR,KAAQzC,GAAQ,CACf,GAA8B,mBAAzBY,GAAaZ,GACjB,OAAO,EAERA,EAAQ+H,GAAgB/H,GAEzB,OAAO,GEdR,IAAAe,GAPA,WACC,MAAO,oCCWJkH,GAAW3H,GADGZ,EAOLuI,GAAU,SChCRvI,UCAX6D,GAAW7D,EAAsC0D,YACjD6E,GFyCaA,GEXjB,ICdA9I,GDAA,SAAuBuE,GACtB,IAAMH,GAAUG,GACf,MAAM,IAAInB,UAAW,uEAAyEmB,EAAM,MAMrG,OAHAA,EAAMuE,KAAW3B,KAAM5C,IAGN,IAAIiD,OAAQjD,EAAI,GAAIA,EAAI,IAAO,MEJjD,IAAA3C,GAPA,SAAgBwG,GACf,OAASA,GAAMA,GCfZL,GAAWxH,GAAsC0D,YACjD8E,GCcQxI,GDmBZ,IAAAqD,GAVA,SAAgB/C,GACf,OACCkH,GAAUlH,IACVkI,GAAOlI,IE3BLkH,GAAWxH,GAAsC2D,SACjD6E,GDcQxI,GCeZ,IAAAyD,GAVA,SAAgBnD,GACf,OACCkH,GAAUlH,IACVkI,GAAOlI,EAAMgD,YCvBXI,GAAc1D,GACd2D,GAAW/C,GAkCf,ICOIgD,GAAc5D,EACdyI,GDfJ,SAAgBnI,GACf,OAASoD,GAAapD,IAAWqD,GAAUrD,ICgBxCqD,GAAWG,GAKfF,GAAa6E,GAAO,cANF/H,IAOlBkD,GAAa6E,GAAO,WAAY9E,IAKhC,IAAAlE,GAAiBgJ,GCxDbP,GAAYlI,GAkChB,IClCIyI,GAAQzI,GACR0I,GDmBJ,SAAuBpI,GACtB,MACkB,iBAAVA,GACG,OAAVA,GACwB,iBAAjBA,EAAM6D,QACb+D,GAAW5H,EAAM6D,SACjB7D,EAAM6D,QAAU,GAChB7D,EAAM6D,QENqB,kBDnBzBN,GAAWnD,EAAsCgD,YACjDwE,GAAYpE,GAAuCJ,YA0GvD,IAAAiF,GAhDA,SAAkBlH,EAAKmH,EAAeC,GACrC,IAAI1C,EACAjC,EACJ,IAAMwE,GAAcjH,KAAUoC,GAAUpC,GACvC,MAAM,IAAIoB,UAAW,0EAA4EpB,EAAM,MAGxG,GAAa,KADb0E,EAAM1E,EAAI0C,QAET,OAAQ,EAET,GAA0B,IAArBmB,UAAUnB,OAAe,CAC7B,IAAM+D,GAAWW,GAChB,MAAM,IAAIhG,UAAW,6DAA+DgG,EAAY,MAEjG,GAAKA,GAAa,EAAI,CACrB,GAAKA,GAAa1C,EACjB,OAAQ,EAETjC,EAAI2E,OAEJ3E,EAAIiC,EAAM0C,GACD,IACR3E,EAAI,QAINA,EAAI,EAGL,GAAKuE,GAAOG,IACX,KAAQ1E,EAAIiC,EAAKjC,IAChB,GAAKuE,GAAOhH,EAAIyC,IACf,OAAOA,OAIT,KAAQA,EAAIiC,EAAKjC,IAChB,GAAKzC,EAAKyC,KAAQ0E,EACjB,OAAO1E,EAIV,OAAQ,GErDTzE,GALcO,GClBd,IAAAW,GAPA,SAAeL,GACd,OAAOV,OAAOkJ,KAAMlJ,OAAQU,KCrBzBwI,GAAO9I,GAmCX,IAAA+I,GAPA,WACC,OAlBD,WACC,OAA8C,KAArCD,GAAMxD,YAAe,IAAKnB,OAiB5BX,CAAM,EAAG,ICxBjBwF,QALoC,IAAhBpJ,OAAOkJ,KCAvB5H,GAAclB,EA+BlB,IC1BIwB,GD0BJH,GAPA,SAAsBf,GACrB,MAAkC,uBAAzBY,GAAaZ,ICzBnB2I,GAAcjJ,GA2BdkJ,GAPJ,WACC,OAAOD,GAAa3D,WAMd6D,GAKP,IC3BI3H,GD2BJ4H,GAAiB5H,GEDjB6H,GAL2BzJ,OAAOC,UAAUyJ,qBDHxCC,IAvBSvJ,GAiBGG,KAAM,OAAQ,KAW9B,IE5BI0D,GAAW7D,EACXyI,GAAQ7H,GAAmC8C,YAC3CwE,GAAYxH,GAAuCgD,YACnD8F,GAAS1F,GACT2F,GFwBajI,GE6BjB,IAAAH,GAzBA,SAA+Bf,EAAOC,GACrC,IAAIiB,EACJ,OACClB,YAKDkB,EAAOgI,GAAOrJ,KAAMG,EAAOC,KACbkJ,IAAoB5F,GAAUvD,IAIzCmI,GAFFlI,GAAYA,IAGX2H,GAAW3H,IACXA,GAAY,GACZA,EAAWD,EAAM6D,OAGZ3C,IC3BR/B,GAL2BO,GCnBvBS,GAAaT,EACb0J,GAAuB9I,GACvBoF,GAAUtF,GACVwH,GAAYpE,GCiChB,IAAArE,GAjBwBO,GACbY,GDQX,SAAsBN,GACrB,OACW,OAAVA,GACiB,iBAAVA,IACN0F,GAAS1F,IACc,iBAAjBA,EAAM6D,QACb+D,GAAW5H,EAAM6D,SACjB7D,EAAM6D,QAAU,GAChB7D,EAAM6D,QAhCSwF,YAiCflJ,GAAYH,EAAO,YAClBoJ,GAAsBpJ,EAAO,WEtC5B2I,GAAcjJ,GACdW,GAAUC,GAKV+F,GAAQZ,MAAMlG,UAAU8G,MA+B5B,IAAAiD,GAVA,SAAetJ,GACd,OAAK2I,GAAa3I,GACVK,GAASgG,GAAMxG,KAAMG,IAEtBK,GAASL,ICnBjB,ICAAuJ,GAZ2B7J,IDK3B,cCEuC,aCWvC8J,IAlB2B9J,GAKjB,CACTF,SAAY,MAO0B,YCCvC,ICJI0B,GDIJuI,GAPA,SAAiCzJ,GAChC,OAASA,EAAMgG,aAAehG,EAAMgG,YAAYzG,YAAcS,GER3D0J,GAAwB,oBAAXlF,YAA2B,EAASA,ODAjDrE,GAAaT,EACbiK,GAAUrJ,GACVkG,GAASpG,GACTwJ,GAAyBpG,GACzBqG,wPACAC,GCAaJ,GD2CbK,GAzBJ,WACC,IAAIC,EACJ,GAAuB,cAAlBxD,GAAQsD,IACZ,OAAO,EAER,IAAME,KAAKF,GACV,KAEmC,IAAjCH,GAASE,GAAeG,IACxB7J,GAAY2J,GAAKE,IACJ,OAAbF,GAAKE,IACkB,WAAvBxD,GAAQsD,GAAKE,KAEbJ,GAAwBE,GAAKE,IAE7B,MAAQrJ,GACT,OAAO,EAGT,OAAO,EAMDsJ,GAKP,IErDI/I,GAA2B,oBAAXsD,OCAhB0F,GHqDahJ,GGpDb0I,GAAyBtJ,GACzB6J,GDGajJ,GCuBjB,IC5BIyE,GAAejG,GACfS,GAAaG,EACbqI,GAAcvI,GACdgK,GAAqB5G,GACrB6G,GAAyBhB,GACzBO,GDSJ,SAAkB5J,GACjB,IAAoB,IAAfmK,KAAyBD,GAC7B,OAAON,GAAwB5J,GAEhC,IACC,OAAO4J,GAAwB5J,GAC9B,MAAQsK,GACT,OAAO,ICfLC,iHAyEJ,IC7EIlK,GAAUD,GACVoK,GAAUhH,GACVjD,GDuBJ,SAAeP,GACd,IAAIyK,EACAC,EACAC,EACAjK,EACAsJ,EACAY,EACAhH,EAGJ,GADAlD,EAAM,GACDiI,GAAa3I,GAAU,CAE3B,IAAM4D,EAAI,EAAGA,EAAI5D,EAAM6D,OAAQD,IAC9BlD,EAAImK,KAAMjH,EAAEpE,YAGb,OAAOkB,EAER,GAAsB,iBAAVV,GAEX,GAAKA,EAAM6D,OAAS,IAAM1D,GAAYH,EAAO,KAC5C,IAAM4D,EAAI,EAAGA,EAAI5D,EAAM6D,OAAQD,IAC9BlD,EAAImK,KAAMjH,EAAEpE,gBAGR,CAEN,IAAe,KADfmL,EAA2B,mBAAV3K,KACQ2F,GAAc3F,GACtC,OAAOU,EAERgK,EAAkBN,IAAsBO,EAEzC,IAAMX,KAAKhK,EACF0K,GAAuB,cAANV,IAAuB7J,GAAYH,EAAOgK,IAClEtJ,EAAImK,KAAM5H,OAAQ+G,IAGpB,GAAKK,GAEJ,IADAI,EAAkBb,GAAwB5J,GACpC4D,EAAI,EAAGA,EAAI2G,GAAe1G,OAAQD,IACvCgH,EAAIL,GAAgB3G,GACZ6G,GAAyB,gBAANG,IAAyBzK,GAAYH,EAAO4K,IACtElK,EAAImK,KAAM5H,OAAQ2H,IAIrB,OAAOlK,GEnDRvB,GDrBkBmB,GADIZ,KA6Bb8K,GAEAnK,GAGDE,GE7BRmI,QALmD,IAA/BpJ,OAAOwL,oBCAvBC,GAAgBzL,OAAOwL,oBAgC3B,IChCItC,GAAO9I,GCgCX,IAAAP,GAjBkBO,GFUlB,SAA8BM,GAC7B,OAAO+K,GAAezL,OAAQU,KCA/B,SAA8BA,GAC7B,OAAOwI,GAAMlJ,OAAQU,KEtBtB0I,QALwD,IAApCpJ,OAAO0L,yBCAvBC,GAAqB3L,OAAO0L,yBAuChC,ICvCI7K,GAAaT,ECkCjB,IAAAP,GAjBkBO,GFUlB,SAAmCM,EAAOC,GACzC,IAAIiL,EACJ,OAAKlL,cAIa,KADlBkL,EAAOD,GAAoBjL,EAAOC,IAF1B,KAG4BiL,GCLrC,SAAmClL,EAAOC,GACzC,OAAKE,GAAYH,EAAOC,GAChB,CACN2C,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ9C,MAASA,EAAOC,IAGX,o4qBErCJc,GAA0CoK,GAK9CzG,OAAOC,QAAU5D,OCLbkF,GAAWvG,GACX0L,sCA4CJ,IAAArK,GA9BA,WACC,IAAIG,EACAmK,EAEJ,GAA6B,mBAAjBD,GACX,OAAO,EAGR,IAEEC,EADiC,mBAAtBD,GAAaE,KACpBF,GAAaE,KAAM,CAAE,EAAG,EAAG,EAAG,IAE9B,IAAIF,GAAc,CAAE,EAAG,EAAG,EAAG,IAElClK,EACC+E,GAAUoF,IACC,IAAXA,EAAG,IACQ,IAAXA,EAAG,IACQ,IAAXA,EAAG,IACQ,IAAXA,EAAG,GAEH,MAAQ1K,GACTO,GAAO,EAER,OAAOA,GCtBR/B,GAL2BO,GCE3B,ICDIqB,SCb2BoK,ODc3B5K,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GAjB2BO,KASnBqB,GAEAR,GEjBJW,GANaxB,GACJY,GAKiBgL,MCN1BrF,GAAWvG,GACXyL,GAAS7K,GA+Bb,IAAAS,GAVA,SAAqBwK,GACpB,IAAMtF,GAAUsF,GACf,MAAM,IAAIhJ,UAAW,oDAAsDgJ,EAAS,KAErF,OAAOJ,GAAOG,KAAMC,IC1BjBtF,GAAWvG,GACXyL,GAAS7K,GA+Bb,IAAAC,GAVA,SAAqBgL,GACpB,IAAMtF,GAAUsF,GACf,MAAM,IAAIhJ,UAAW,oDAAsDgJ,EAAS,KAErF,OAAO,IAAIJ,GAAQI,ICOpBpM,GHtBiB+B,GGMNZ,GACIF,GCJf,ICDIC,GCb8B,mBAAdS,UAA6BA,eAAY,EDczDP,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GAjB0BO,IASlBW,GAEAE,GEvBJK,GAAclB,EAKd8L,GAAwC,mBAAfC,WA6B7B,IClCI1K,GAA+B,mBAAf0K,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuB1L,GACtB,OACGwL,IAAiBxL,aAAiByL,YACX,wBAAzB7K,GAAaZ,IEzBX2L,GDGa5K,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArBwK,GACX,OAAO,EAGR,IAECxK,EAAM,IAAIwK,GADVxK,EAAM,CAAE,EAAG,MAAO,KAAMyK,IAAaA,MAErC1K,EACCwK,GAAcvK,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQyK,MAAbzK,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCb+B,mBAAfoL,WAA8BA,gBAAa,EDc3DlL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKdmM,GAAsD,mBAAtBC,kBA6BpC,IClCI/K,GAAsC,mBAAtB+K,kBAAqCA,kBAAoB,KCAzEC,GFwBJ,SAA8B/L,GAC7B,OACG6L,IAAwB7L,aAAiB8L,mBAClB,+BAAzBlL,GAAaZ,IE1BXgM,GDIajL,GCuCjB,IAAAA,GA7BA,WACC,IAAIG,EACAC,EAEJ,GAAwC,mBAA5B6K,GACX,OAAO,EAGR,IACC7K,EAAM,IAAI6K,GAAyB,EAAG,EAAG,EAAG,EAAG,KAAM,KAAM,IAAK,MAChE9K,EACC6K,GAAqB5K,IACR,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,MAAbA,EAAK,IACQ,MAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbsC,mBAAtByL,kBAAqCA,uBAAoB,EDczEvL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjBkCO,KFS1BW,GAEAE,GGvBJK,GAAclB,EAKduM,GAAwC,mBAAfC,WA6B7B,IClCInL,GAA+B,mBAAfmL,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuBnM,GACtB,OACGiM,IAAiBjM,aAAiBkM,YACX,wBAAzBtL,GAAaZ,IExBXoM,GDEarL,GCsCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArBiL,GACX,OAAO,EAGR,IACCjL,EAAM,IAAIiL,GAAkB,CAAE,EAAG,MAAO,KAAMC,QAC9CnL,EACCiL,GAAchL,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,QDDbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEvBR,ICDIb,GCb+B,mBAAf6L,WAA8BA,gBAAa,EDc3D3L,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKd4M,GAA0C,mBAAhBC,YA6B9B,IClCIxL,GAAgC,mBAAhBwL,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBxM,GACvB,OACGsM,IAAkBtM,aAAiBuM,aACZ,yBAAzB3L,GAAaZ,IEzBXyM,GDGa1L,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAkC,mBAAtBsL,GACX,OAAO,EAGR,IAECtL,EAAM,IAAIsL,GADVtL,EAAM,CAAE,EAAG,MAAO,KAAMuL,MAAcA,QAEtCxL,EACCsL,GAAerL,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQuL,QAAbvL,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbgC,mBAAhBkM,YAA+BA,iBAAc,EDc7DhM,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB4BO,KFSpBW,GAEAE,GGvBJK,GAAclB,EAKdiN,GAAwC,mBAAfC,WA6B7B,IClCI7L,GAA+B,mBAAf6L,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuB7M,GACtB,OACG2M,IAAiB3M,aAAiB4M,YACX,wBAAzBhM,GAAaZ,IExBX8M,GDEa/L,GCsCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArB2L,GACX,OAAO,EAGR,IACC3L,EAAM,IAAI2L,GAAkB,CAAE,EAAG,MAAO,KAAMC,aAC9C7L,EACC2L,GAAc1L,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,aDDbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEvBR,ICDIb,GCb+B,mBAAfuM,WAA8BA,gBAAa,EDc3DrM,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKdsN,GAA0C,mBAAhBC,YA6B9B,IClCIlM,GAAgC,mBAAhBkM,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBlN,GACvB,OACGgN,IAAkBhN,aAAiBiN,aACZ,yBAAzBrM,GAAaZ,IEzBXmN,GDGapM,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAkC,mBAAtBgM,GACX,OAAO,EAGR,IAEChM,EAAM,IAAIgM,GADVhM,EAAM,CAAE,EAAG,MAAO,KAAMiM,WAAcA,aAEtClM,EACCgM,GAAe/L,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQiM,aAAbjM,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbgC,mBAAhB4M,YAA+BA,iBAAc,EDc7D1M,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB4BO,KFSpBW,GAEAE,GGvBJK,GAAclB,EAKd2N,GAA4C,mBAAjBC,aA6B/B,IClCIvM,GAAiC,mBAAjBuM,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyBvN,GACxB,OACGqN,IAAmBrN,aAAiBsN,cACb,0BAAzB1M,GAAaZ,IE1BXwH,GAAOlH,GACPkN,GDGazM,GCqCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAmC,mBAAvBqM,GACX,OAAO,EAGR,IACCrM,EAAM,IAAIqM,GAAoB,CAAE,EAAK,MAAO,KAAM,OAClDtM,EACCqM,GAAgBpM,IACH,IAAbA,EAAK,IACQ,oBAAbA,EAAK,KACS,oBAAdA,EAAK,IACLA,EAAK,KAAQqG,GAEb,MAAQ7G,GACTO,GAAO,EAER,OAAOA,GCtBR,ICDIb,GCbiC,mBAAjBiN,aAAgCA,kBAAe,EDc/D/M,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB6BO,KFSrBW,GAEAE,GGvBJK,GAAclB,EAKd+N,GAA4C,mBAAjBC,aA6B/B,IClCI3M,GAAiC,mBAAjB2M,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyB3N,GACxB,OACGyN,IAAmBzN,aAAiB0N,cACb,0BAAzB9M,GAAaZ,IE1BX4N,GDIa7M,GCoCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAmC,mBAAvByM,GACX,OAAO,EAGR,IACCzM,EAAM,IAAIyM,GAAoB,CAAE,EAAK,MAAO,KAAMC,MAClD3M,EACCyM,GAAgBxM,IACH,IAAbA,EAAK,IACQ,OAAbA,EAAK,KACS,OAAdA,EAAK,IACLA,EAAK,IAAQA,EAAK,GAElB,MAAQR,GACTO,GAAO,EAER,OAAOA,GCrBR,ICKIG,GANAhB,GCbiC,mBAAjBqN,aAAgCA,kBAAe,EDc/DnN,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCajBpB,GET4B3B,KFSrBW,GAEAE,GAMR,IG7BIO,GAAYpB,GACZ+L,GAAanL,GACbwL,GAAoB1L,GACpB8L,GAAa1I,GACb+I,GAAclD,GACduD,GAAakB,GACbb,GAAcc,GACdT,GAAeU,GACfN,GHqBarM,GGJjB,SAAS4M,GAAW9M,GACnB,OAAO,IAAIL,GAAWK,GAUvB,SAAS+M,GAAY/M,GACpB,OAAO,IAAIsK,GAAYtK,GAUxB,SAASgN,GAAmBhN,GAC3B,OAAO,IAAI2K,GAAmB3K,GAU/B,SAASiN,GAAYjN,GACpB,OAAO,IAAI+K,GAAY/K,GAUxB,SAASkN,GAAalN,GACrB,OAAO,IAAIoL,GAAapL,GAUzB,SAASmN,GAAYnN,GACpB,OAAO,IAAIyL,GAAYzL,GAUxB,SAASoN,GAAapN,GACrB,OAAO,IAAI8L,GAAa9L,GAUzB,SAASqN,GAAcrN,GACtB,OAAO,IAAImM,GAAcnM,GAU1B,SAASsN,GAActN,GACtB,OAAO,IAAIuM,GAAcvM,GAgC1B,IClJIhB,GAAaT,EACbgG,GAAUpF,GACV2F,GAAW7F,GACXsO,GAAUlL,GACVgD,GAAS6C,GACTsF,GAASb,GACTnE,GAAUoE,GACVa,GAAaZ,GACbjD,GAAgB8D,GAChB5D,GAAqB6D,GACrB/G,GAAiBgH,GACjBzN,GAAiB0N,EACjBC,GAAaC,GACbC,GD+GO,CACTlB,UAAaA,GACbC,WAAcA,GACdC,kBAAqBA,GACrBC,WAAcA,GACdC,YAAeA,GACfC,WAAcA,GACdC,YAAeA,GACfC,aAAgBA,GAChBC,aAAgBA,ICQlB,SAASW,GAAUC,EAAKC,EAAMC,EAAOC,EAAMC,GAC1C,IAAIC,EACAlH,EACApC,EACA8E,EACA7J,EACAsO,EACAC,EACArI,EACA3D,EACAiM,EAKJ,GAHAJ,GAAS,EAIO,iBAARJ,GACC,OAARA,EAEA,OAAOA,EAER,GAAKpJ,GAAUoJ,GACd,OAAOJ,GAAYI,GAEpB,GAAKX,GAASW,GACb,OAnFF,SAAoB/E,GACnB,IAEI9B,EACA0C,EACA4E,EACAH,EACAhP,EACAiD,EAPA2L,EAAQ,GACRC,EAAO,GA8BX,IArBA7O,EAAM,IAAI2J,EAAMtE,YAAasE,EAAMyF,SAEnCR,EAAM1E,KAAMP,GACZkF,EAAK3E,KAAMlK,GAGN2J,EAAM0F,QACVrP,EAAIqP,MAAQ1F,EAAM0F,OAGd1F,EAAM2F,OACVtP,EAAIsP,KAAO3F,EAAM2F,MAEb3F,EAAM4F,QACVvP,EAAIuP,MAAQ5F,EAAM4F,OAEd5F,EAAM6F,UACVxP,EAAIwP,QAAU7F,EAAM6F,SAGrB3H,EAAOoG,GAAYtE,GACb1G,EAAI,EAAGA,EAAI4E,EAAK3E,OAAQD,IAC7B+L,EAAMnH,EAAM5E,GACZsH,EAAOD,GAAoBX,EAAOqF,GAC7BxP,GAAY+K,EAAM,WACtB4E,EAAQpK,GAAS4E,EAAOqF,IAAY,GAAK,GACzCzE,EAAKlL,MAAQoP,GAAU9E,EAAOqF,GAAOG,EAAKP,EAAOC,GAAO,IAEzDlO,GAAgBX,EAAKgP,EAAKzE,GAE3B,OAAOvK,EA0CCyP,CAAWf,GAKnB,GAAc,UAFdjJ,EAAOI,GAAQ6I,IAGd,OAAO,IAAIgB,MAAOhB,GAEnB,GAAc,WAATjJ,EACJ,OAAOuI,GAAQU,EAAI7P,YAEpB,GAAc,QAAT4G,EACJ,OAAO,IAAIkK,IAAKjB,GAEjB,GAAc,QAATjJ,EACJ,OAAO,IAAImK,IAAKlB,GAEjB,GACU,WAATjJ,GACS,YAATA,GACS,WAATA,EAGA,OAAOiJ,EAAIrM,UAGZ,GADA3B,EAAO8N,GAAa/I,GAEnB,OAAO/E,EAAMgO,GAGd,GACU,UAATjJ,GACS,WAATA,EAGA,MAA8B,mBAAlB9G,OAAOkR,OA1KrB,SAAwBnB,GACvB,IAAIE,EACAkB,EACArK,EACAoJ,EACAtE,EACA4E,EACAF,EACAhM,EAUJ,IARA2L,EAAQ,GACRC,EAAO,GAEPI,EAAMtQ,OAAOoR,OAAQ3I,GAAgBsH,IACrCE,EAAM1E,KAAMwE,GACZG,EAAK3E,KAAM+E,GAEXa,EAAQ1F,GAAesE,GACjBzL,EAAI,EAAGA,EAAI6M,EAAM5M,OAAQD,IAC9BwC,EAAOqK,EAAO7M,GACdsH,EAAOD,GAAoBoE,EAAKjJ,GAC3BjG,GAAY+K,EAAM,WACtB4E,EAAQpK,GAAS2J,EAAIjJ,IAAY,GAAK,GACtC8E,EAAKlL,MAAQoP,GAAUC,EAAIjJ,GAAO0J,EAAKP,EAAOC,GAAO,IAEtDlO,GAAgBsO,EAAKxJ,EAAM8E,GAW5B,OATM5L,OAAOqR,aAActB,IAC1B/P,OAAOsR,kBAAmBhB,GAEtBtQ,OAAOuR,SAAUxB,IACrB/P,OAAOwR,KAAMlB,GAETtQ,OAAOyR,SAAU1B,IACrB/P,OAAOkR,OAAQZ,GAETA,EAuIEoB,CAAe3B,GAEhB,GAIR,GADA7G,EAAOoG,GAAYS,GACdI,EAAQ,EAEZ,IADAC,EAAStJ,EACHyJ,EAAI,EAAGA,EAAIrH,EAAK3E,OAAQgM,IAE7BtI,EAAI8H,EADJM,EAAMnH,EAAMqH,IAIZzJ,EAAOI,GAAQe,GAED,iBAANA,GACD,OAANA,GAEU,UAATnB,GACS,WAATA,GAEDH,GAAUsB,GAEM,WAAXmI,GACJxE,EAAOD,GAAoBoE,EAAKM,GAC3BxP,GAAY+K,EAAM,WACtBA,EAAKlL,MAAQoP,GAAU7H,IAExBjG,GAAgBgO,EAAMK,EAAKzE,IAE3BoE,EAAMK,GAAQP,GAAU7H,IAMd,KADZ3D,EAAI+F,GAAS4F,EAAOhI,KAMpBqI,EAAQlK,GAAS6B,GAAQ,IAAI9B,MAAO8B,EAAE1D,QAAW,GACjD0L,EAAM1E,KAAMtD,GACZiI,EAAK3E,KAAM+E,GACK,UAAXF,EACJJ,EAAMK,GAAQP,GAAU7H,EAAGqI,EAAKL,EAAOC,EAAMC,IAE7CvE,EAAOD,GAAoBoE,EAAKM,GAC3BxP,GAAY+K,EAAM,WACtBA,EAAKlL,MAAQoP,GAAU7H,EAAGqI,EAAKL,EAAOC,EAAMC,IAE7CnO,GAAgBgO,EAAMK,EAAKzE,KAd3BoE,EAAMK,GAAQH,EAAM5L,QAiBhB,GAAc,UAATwC,EACX,IAAMyJ,EAAI,EAAGA,EAAIrH,EAAK3E,OAAQgM,IAE7BP,EADAK,EAAMnH,EAAMqH,IACER,EAAKM,QAGpB,IAAME,EAAI,EAAGA,EAAIrH,EAAK3E,OAAQgM,IAC7BF,EAAMnH,EAAMqH,GACZ3E,EAAOD,GAAoBoE,EAAKM,GAChCrO,GAAgBgO,EAAMK,EAAKzE,GAY7B,OATM5L,OAAOqR,aAActB,IAC1B/P,OAAOsR,kBAAmBtB,GAEtBhQ,OAAOuR,SAAUxB,IACrB/P,OAAOwR,KAAMxB,GAEThQ,OAAOyR,SAAU1B,IACrB/P,OAAOkR,OAAQlB,GAETA,EAMR,IC3RI5J,GAAUhG,GACVmI,GAAuBvH,GAAmD8C,YAC1EoE,GAAOpH,GACPgP,GDwRaA,GCtOjB,IAAA6B,GAnBA,SAAejR,EAAOyP,GACrB,IAAI/O,EACJ,GAAKsE,UAAUnB,OAAS,EAAI,CAC3B,IAAMgE,GAAsB4H,GAC3B,MAAM,IAAIlN,UAAW,oEAAsEkN,EAAQ,MAEpG,GAAe,IAAVA,EACJ,OAAOzP,OAGRyP,EAAQjI,GAGT,OADA9G,EAAQgF,GAAS1F,GAAY,IAAIyF,MAAOzF,EAAM6D,QAAW,GAClDuL,GAAUpP,EAAOU,EAAK,CAACV,GAAQ,CAACU,GAAM+O,ICd9CtQ,GALWO,GC5BPgG,GAAUhG,GA8Bd,IC9BI2D,GDmBJ,SAAmBrD,GAClB,MACkB,iBAAVA,GACG,OAAVA,IACC0F,GAAS1F,ICtBR6G,GAAavG,GACbyH,GAAiB3H,GACjBD,GAAaqD,EACb5C,GAAcyI,EAKd6H,GAAkB5R,OAAOC,UAgF7B,IAAAwB,GAvCA,SAAwBf,GACvB,IAAIgI,EAGJ,QAAM3E,GAAUrD,OAIhBgI,EAAQD,GAAgB/H,MAOtBG,GAAYH,EAAO,gBAGpBG,GAAY6H,EAAO,gBACnBnB,GAAYmB,EAAMhC,cACmB,sBAArCpF,GAAaoH,EAAMhC,cAGnB7F,GAAY6H,EAAO,kBACnBnB,GAAYmB,EAAMmJ,iBAIjBnJ,IAAUkJ,IAzDb,SAAmBjP,GAClB,IAAI0N,EAGJ,IAAMA,KAAO1N,EACZ,IAAM9B,GAAY8B,EAAK0N,GACtB,OAAO,EAGT,OAAO,EAmDLyB,CAAUpR,MCjFTqD,GCegB3D,GDdhBS,GAAaG,EACbiD,GAAWnD,EAAsCgD,YAqCrD,wJEvCIU,GAAUpE,GACV4P,GAAOhP,GACP+Q,GFeJ,SAAmBC,EAAMC,GACxB,OAAMlO,GAAUkO,GAGXpR,GAAYoR,EAAS,SACzBD,EAAKE,IAAMD,EAAQC,KACbjO,GAAU+N,EAAKE,MACb,IAAIjP,UAAW,qEAAuE+O,EAAKE,IAAM,MAGrGrR,GAAYoR,EAAS,aACzBD,EAAKvB,QAAUwB,EAAQxB,SACjBxM,GAAU+N,EAAKvB,UACb,IAAIxN,UAAW,yEAA2E+O,EAAKvB,QAAU,MAG3G,KAdC,IAAIxN,UAAW,iEAAmEgP,EAAU,OEhBjGE,GAAWjO,GAwDf,IAAAkO,GAnCA,SAAkBH,GACjB,IAAID,EACA3Q,EAGJ,GAFA2Q,EAAOhC,GAAMmC,IACb9Q,EAAM0Q,GAAUC,EAAMC,GAErB,MAAM5Q,EAEP,OAUA,WACC,IAEIgR,EACA/N,EAHAqM,EAAOjL,UAAW,GAClBwM,EAAMF,EAAKE,IAAM,SAASvB,EAG9B,IAAMrM,EAAI,EAAGA,EAAIoB,UAAUnB,OAAQD,IAClC4N,GAAO,UAAYI,mBAAoB5M,UAAWpB,IAInD,OAFA+N,EAAM7N,GAASwN,EAAKvB,QAAS,UAAWyB,GACxCG,EAAM7N,GAAS6N,EAAK,WAAY1B,KCtC9B4B,GCbUnS,GACCY,IDWGZ,EAOLmS,GAAwB,UALvBzR,IAUd,IAAAjB,GAAiB0S,UEJZC,IACGzR,ECZR,WACC,MAAM,IAAIoC,MAAOsP,GAAQ"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 20ddac1..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './int8array.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/int8array.js b/lib/int8array.js deleted file mode 100644 index 667410e..0000000 --- a/lib/int8array.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b45b083..d1ce45b 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./browser.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..544b59f --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..78b4cc4 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 63e7fe2..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './int8array.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 28da7baa5a09343821cea25ae9fe6a360118f6f5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 03:41:50 +0000 Subject: [PATCH 005/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 2689 -------------------------------------------- stats_node.html | 2689 -------------------------------------------- 6 files changed, 5386 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index c221f2d..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=r()}(this,(function(){"use strict";function t(t){var r=t.default;if("function"==typeof r){var n=function(){return r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var e=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,e.get?e:{enumerable:!0,get:function(){return t[r]}})})),n}var r=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();var n=function(){return r&&"symbol"==typeof Symbol.toStringTag},e=Object.prototype.toString,o=e;var i=function(t){return o.call(t)},u=Object.prototype.hasOwnProperty;var f=function(t,r){return null!=t&&u.call(t,r)},a="function"==typeof Symbol?Symbol.toStringTag:"",c=f,s=a,l=e;var h=i,p=function(t){var r,n,e;if(null==t)return l.call(t);n=t[s],r=c(t,s);try{t[s]=void 0}catch(r){return l.call(t)}return e=l.call(t),r?t[s]=n:delete t[s],e},y=n()?p:h,v=y,g="function"==typeof Int8Array;var w="function"==typeof Int8Array?Int8Array:null,d=function(t){return g&&t instanceof Int8Array||"[object Int8Array]"===v(t)},b=w;var m=function(){var t,r;if("function"!=typeof b)return!1;try{r=new b([1,3.14,-3.14,128]),t=d(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t},A=m,E="function"==typeof Int8Array?Int8Array:void 0,_="function"==typeof Object.defineProperty?Object.defineProperty:null;var O=function(){try{return _({},"x",{}),!0}catch(t){return!1}},P=Object.defineProperty,j=Object.prototype,R=j.toString,T=j.__defineGetter__,U=j.__defineSetter__,I=j.__lookupGetter__,S=j.__lookupSetter__;var B=function(t,r,n){var e,o,i,u;if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof n||null===n||"[object Array]"===R.call(n))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+n+"`.");if((o="value"in n)&&(I.call(t,r)||S.call(t,r)?(e=t.__proto__,t.__proto__=j,delete t[r],t[r]=n.value,t.__proto__=e):t[r]=n.value),i="get"in n,u="set"in n,o&&(i||u))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return i&&T&&T.call(t,r,n.get),u&&U&&U.call(t,r,n.set),t},Y=P,x=B,C=O()?Y:x,M=C;var L=function(t,r,n){M(t,r,{configurable:!1,enumerable:!1,writable:!1,value:n})},F=L;var D=function(t){return"string"==typeof t},N=String.prototype.valueOf;var k=y,V=function(t){try{return N.call(t),!0}catch(t){return!1}},z=n();var G=function(t){return"object"==typeof t&&(t instanceof String||(z?V(t):"[object String]"===k(t)))},X=D,$=G;var H=F,W=function(t){return X(t)||$(t)},q=G;H(W,"isPrimitive",D),H(W,"isObject",q);var J=W,Z=J.isPrimitive,K=/[-\/\\^$*+?.()|[\]{}]/g;var Q=function(t){var r,n;if(!Z(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");if("/"===t[0])for(n=t.length-1;n>=0&&"/"!==t[n];n--);return void 0===n||n<=0?t.replace(K,"\\$&"):(r=(r=t.substring(1,n)).replace(K,"\\$&"),t=t[0]+r+t.substring(n))},tt=/./;var rt=function(t){return"boolean"==typeof t},nt=Boolean.prototype.toString;var et=y,ot=function(t){try{return nt.call(t),!0}catch(t){return!1}},it=n();var ut=function(t){return"object"==typeof t&&(t instanceof Boolean||(it?ot(t):"[object Boolean]"===et(t)))},ft=rt,at=ut;var ct=F,st=function(t){return ft(t)||at(t)},lt=ut;ct(st,"isPrimitive",rt),ct(st,"isObject",lt);var ht=st;var pt=function(){return new Function("return this;")()},yt="object"==typeof self?self:null,vt="object"==typeof window?window:null,gt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},wt="object"==typeof gt?gt:null;module.exports=wt;var dt=ht.isPrimitive,bt=pt,mt=yt,At=vt,Et=t(Object.freeze({__proto__:null}));var _t=function(t){if(arguments.length){if(!dt(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return bt()}if(mt)return mt;if(At)return At;if(Et)return Et;throw new Error("unexpected error. Unable to resolve global object.")},Ot=_t(),Pt=Ot.document&&Ot.document.childNodes,jt=Int8Array,Rt=tt,Tt=Pt,Ut=jt;var It=function(){return"function"==typeof Rt||"object"==typeof Ut||"function"==typeof Tt};var St=function(){return/^\s*function\s*([^(]*)/i},Bt=St;F(Bt,"REGEXP",St());var Yt=Bt,xt=y;var Ct=Array.isArray?Array.isArray:function(t){return"[object Array]"===xt(t)},Mt=Ct;var Lt=function(t){return null!==t&&"object"==typeof t};F(Lt,"isObjectLikeArray",function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(r){var n,e;if(!Mt(r))return!1;if(0===(n=r.length))return!1;for(e=0;ejr&&Rr(t)},Ur=mr.isPrimitive,Ir=Tr;var Sr=function(t){return Ur(t)&&Ir(t)},Br=mr.isObject,Yr=Tr;var xr=function(t){return Br(t)&&Yr(t.valueOf())},Cr=Sr,Mr=xr;var Lr=F,Fr=function(t){return Cr(t)||Mr(t)},Dr=xr;Lr(Fr,"isPrimitive",Sr),Lr(Fr,"isObject",Dr);var Nr=Fr,kr=Nr.isPrimitive;var Vr=function(t){return kr(t)&&t>=0},zr=Nr.isObject;var Gr=function(t){return zr(t)&&t.valueOf()>=0},Xr=Vr,$r=Gr;var Hr=F,Wr=function(t){return Xr(t)||$r(t)},qr=Gr;Hr(Wr,"isPrimitive",Vr),Hr(Wr,"isObject",qr);var Jr=Wr,Zr=Object.getPrototypeOf;var Kr=function(t){return t.__proto__},Qr=y,tn=Kr;var rn=function(t){var r=tn(t);return r||null===r?r:"[object Function]"===Qr(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null},nn=Zr,en=rn,on=Zt(Object.getPrototypeOf)?nn:en;var un=function(t){return null==t?null:(t=Object(t),on(t))},fn=un,an=y;var cn=function(t){if("object"!=typeof t||null===t)return!1;if(t instanceof Error)return!0;for(;t;){if("[object Error]"===an(t))return!0;t=fn(t)}return!1};var sn=function(){return/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/},ln=sn;F(ln,"REGEXP",sn());var hn=J.isPrimitive,pn=ln;var yn=function(t){if(!hn(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");return(t=pn().exec(t))?new RegExp(t[1],t[2]):null};var vn=function(t){return t!=t},gn=mr.isPrimitive,wn=vn;var dn=function(t){return gn(t)&&wn(t)},bn=mr.isObject,mn=vn;var An=function(t){return bn(t)&&mn(t.valueOf())},En=dn,_n=An;var On=F,Pn=function(t){return En(t)||_n(t)},jn=An;On(Pn,"isPrimitive",dn),On(Pn,"isObject",jn);var Rn=Pn,Tn=Or;var Un=Rn,In=function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Tn(t.length)&&t.length>=0&&t.length<=9007199254740991},Sn=J.isPrimitive,Bn=Nr.isPrimitive;var Yn=function(t,r,n){var e,o;if(!In(t)&&!Sn(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(e=t.length))return-1;if(3===arguments.length){if(!Bn(n))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+n+"`.");if(n>=0){if(n>=e)return-1;o=n}else(o=e+n)<0&&(o=0)}else o=0;if(Un(r)){for(;o=0&&r=0&&t.length<=4294967295&&Qn(t,"callee")&&!te(t,"callee")},oe=ee,ie=Cn,ue=Array.prototype.slice;var fe=function(t){return oe(t)?ie(ue.call(t)):ie(t)};var ae=Kn((function(){}),"prototype"),ce=!Kn({toString:null},"toString");var se,le=function(t){return t.constructor&&t.constructor.prototype===t},he="undefined"==typeof window?void 0:window,pe=f,ye=xn,ve=qt,ge=le,we=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],de=he;se=function(){var t;if("undefined"===ve(de))return!1;for(t in de)try{-1===ye(we,t)&&pe(de,t)&&null!==de[t]&&"object"===ve(de[t])&&ge(de[t])}catch(t){return!0}return!1}();var be="undefined"!=typeof window,me=se,Ae=le,Ee=be;var _e=Ft,Oe=f,Pe=ee,je=ae,Re=ce,Te=function(t){if(!1===Ee&&!me)return Ae(t);try{return Ae(t)}catch(t){return!1}},Ue=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var Ie=Cn,Se=fe,Be=function(t){var r,n,e,o,i,u,f;if(o=[],Pe(t)){for(f=0;f0&&!Oe(t,"0"))for(f=0;f!1})),ze=[],Ge=[],Xe="undefined"!=typeof Uint8Array?Uint8Array:Array,$e=!1;function He(){$e=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=t.length;r>18&63]+ze[o>>12&63]+ze[o>>6&63]+ze[63&o]);return i.join("")}function qe(t){var r;$e||He();for(var n=t.length,e=n%3,o="",i=[],u=16383,f=0,a=n-e;fa?a:f+u));return 1===e?(r=t[n-1],o+=ze[r>>2],o+=ze[r<<4&63],o+="=="):2===e&&(r=(t[n-2]<<8)+t[n-1],o+=ze[r>>10],o+=ze[r>>4&63],o+=ze[r<<2&63],o+="="),i.push(o),i.join("")}function Je(t,r,n,e,o){var i,u,f=8*o-e-1,a=(1<>1,s=-7,l=n?o-1:0,h=n?-1:1,p=t[r+l];for(l+=h,i=p&(1<<-s)-1,p>>=-s,s+=f;s>0;i=256*i+t[r+l],l+=h,s-=8);for(u=i&(1<<-s)-1,i>>=-s,s+=e;s>0;u=256*u+t[r+l],l+=h,s-=8);if(0===i)i=1-c;else{if(i===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,e),i-=c}return(p?-1:1)*u*Math.pow(2,i-e)}function Ze(t,r,n,e,o,i){var u,f,a,c=8*i-o-1,s=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=e?0:i-1,y=e?1:-1,v=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-u))<1&&(u--,a*=2),(r+=u+l>=1?h/a:h*Math.pow(2,1-l))*a>=2&&(u++,a/=2),u+l>=s?(f=0,u=s):u+l>=1?(f=(r*a-1)*Math.pow(2,o),u+=l):(f=r*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[n+p]=255&f,p+=y,f/=256,o-=8);for(u=u<0;t[n+p]=255&u,p+=y,u/=256,c-=8);t[n+p-y]|=128*v}var Ke={}.toString,Qe=Array.isArray||function(t){return"[object Array]"==Ke.call(t)};eo.TYPED_ARRAY_SUPPORT=void 0===gt.TYPED_ARRAY_SUPPORT||gt.TYPED_ARRAY_SUPPORT;var to=ro();function ro(){return eo.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function no(t,r){if(ro()=ro())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ro().toString(16)+" bytes");return 0|t}function co(t){return!(null==t||!t._isBuffer)}function so(t,r){if(co(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Fo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Do(t).length;default:if(e)return Fo(t).length;r=(""+r).toLowerCase(),e=!0}}function lo(t,r,n){var e=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ro(this,r,n);case"utf8":case"utf-8":return _o(this,r,n);case"ascii":return Po(this,r,n);case"latin1":case"binary":return jo(this,r,n);case"base64":return Eo(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),e=!0}}function ho(t,r,n){var e=t[r];t[r]=t[n],t[n]=e}function po(t,r,n,e,o){if(0===t.length)return-1;if("string"==typeof n?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=eo.from(r,e)),co(r))return 0===r.length?-1:yo(t,r,n,e,o);if("number"==typeof r)return r&=255,eo.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):yo(t,[r],n,e,o);throw new TypeError("val must be string, number or Buffer")}function yo(t,r,n,e,o){var i,u=1,f=t.length,a=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(t.length<2||r.length<2)return-1;u=2,f/=2,a/=2,n/=2}function c(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var s=-1;for(i=n;if&&(n=f-a),i=n;i>=0;i--){for(var l=!0,h=0;ho&&(e=o):e=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");e>i/2&&(e=i/2);for(var u=0;u>8,o=n%256,i.push(o),i.push(e);return i}(r,t.length-n),t,n,e)}function Eo(t,r,n){return 0===r&&n===t.length?qe(t):qe(t.slice(r,n))}function _o(t,r,n){n=Math.min(t.length,n);for(var e=[],o=r;o239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(s=c);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&c)<<6|63&i)>127&&(s=a);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(a=(15&c)<<12|(63&i)<<6|63&u)>2047&&(a<55296||a>57343)&&(s=a);break;case 4:i=t[o+1],u=t[o+2],f=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&f)&&(a=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&f)>65535&&a<1114112&&(s=a)}null===s?(s=65533,l=1):s>65535&&(s-=65536,e.push(s>>>10&1023|55296),s=56320|1023&s),e.push(s),o+=l}return function(t){var r=t.length;if(r<=Oo)return String.fromCharCode.apply(String,t);var n="",e=0;for(;e0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},eo.prototype.compare=function(t,r,n,e,o){if(!co(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===e&&(e=0),void 0===o&&(o=this.length),r<0||n>t.length||e<0||o>this.length)throw new RangeError("out of range index");if(e>=o&&r>=n)return 0;if(e>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(e>>>=0),u=(n>>>=0)-(r>>>=0),f=Math.min(i,u),a=this.slice(e,o),c=t.slice(r,n),s=0;so)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var i=!1;;)switch(e){case"hex":return vo(this,t,r,n);case"utf8":case"utf-8":return go(this,t,r,n);case"ascii":return wo(this,t,r,n);case"latin1":case"binary":return bo(this,t,r,n);case"base64":return mo(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ao(this,t,r,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),i=!0}},eo.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Oo=4096;function Po(t,r,n){var e="";n=Math.min(t.length,n);for(var o=r;oe)&&(n=e);for(var o="",i=r;in)throw new RangeError("Trying to access beyond buffer length")}function Io(t,r,n,e,o,i){if(!co(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function So(t,r,n,e){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-n,2);o>>8*(e?o:1-o)}function Bo(t,r,n,e){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-n,4);o>>8*(e?o:3-o)&255}function Yo(t,r,n,e,o,i){if(n+e>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function xo(t,r,n,e,o){return o||Yo(t,0,n,4),Ze(t,r,n,e,23,4),n+4}function Co(t,r,n,e,o){return o||Yo(t,0,n,8),Ze(t,r,n,e,52,8),n+8}eo.prototype.slice=function(t,r){var n,e=this.length;if((t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r0&&(o*=256);)e+=this[t+--r]*o;return e},eo.prototype.readUInt8=function(t,r){return r||Uo(t,1,this.length),this[t]},eo.prototype.readUInt16LE=function(t,r){return r||Uo(t,2,this.length),this[t]|this[t+1]<<8},eo.prototype.readUInt16BE=function(t,r){return r||Uo(t,2,this.length),this[t]<<8|this[t+1]},eo.prototype.readUInt32LE=function(t,r){return r||Uo(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},eo.prototype.readUInt32BE=function(t,r){return r||Uo(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},eo.prototype.readIntLE=function(t,r,n){t|=0,r|=0,n||Uo(t,r,this.length);for(var e=this[t],o=1,i=0;++i=(o*=128)&&(e-=Math.pow(2,8*r)),e},eo.prototype.readIntBE=function(t,r,n){t|=0,r|=0,n||Uo(t,r,this.length);for(var e=r,o=1,i=this[t+--e];e>0&&(o*=256);)i+=this[t+--e]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},eo.prototype.readInt8=function(t,r){return r||Uo(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},eo.prototype.readInt16LE=function(t,r){r||Uo(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},eo.prototype.readInt16BE=function(t,r){r||Uo(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},eo.prototype.readInt32LE=function(t,r){return r||Uo(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},eo.prototype.readInt32BE=function(t,r){return r||Uo(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},eo.prototype.readFloatLE=function(t,r){return r||Uo(t,4,this.length),Je(this,t,!0,23,4)},eo.prototype.readFloatBE=function(t,r){return r||Uo(t,4,this.length),Je(this,t,!1,23,4)},eo.prototype.readDoubleLE=function(t,r){return r||Uo(t,8,this.length),Je(this,t,!0,52,8)},eo.prototype.readDoubleBE=function(t,r){return r||Uo(t,8,this.length),Je(this,t,!1,52,8)},eo.prototype.writeUIntLE=function(t,r,n,e){(t=+t,r|=0,n|=0,e)||Io(this,t,r,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+n},eo.prototype.writeUInt8=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,1,255,0),eo.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},eo.prototype.writeUInt16LE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,2,65535,0),eo.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):So(this,t,r,!0),r+2},eo.prototype.writeUInt16BE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,2,65535,0),eo.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):So(this,t,r,!1),r+2},eo.prototype.writeUInt32LE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,4,4294967295,0),eo.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):Bo(this,t,r,!0),r+4},eo.prototype.writeUInt32BE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,4,4294967295,0),eo.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Bo(this,t,r,!1),r+4},eo.prototype.writeIntLE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);Io(this,t,r,n,o-1,-o)}var i=0,u=1,f=0;for(this[r]=255&t;++i>0)-f&255;return r+n},eo.prototype.writeIntBE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);Io(this,t,r,n,o-1,-o)}var i=n-1,u=1,f=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===f&&0!==this[r+i+1]&&(f=1),this[r+i]=(t/u>>0)-f&255;return r+n},eo.prototype.writeInt8=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,1,127,-128),eo.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},eo.prototype.writeInt16LE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,2,32767,-32768),eo.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):So(this,t,r,!0),r+2},eo.prototype.writeInt16BE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,2,32767,-32768),eo.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):So(this,t,r,!1),r+2},eo.prototype.writeInt32LE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,4,2147483647,-2147483648),eo.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):Bo(this,t,r,!0),r+4},eo.prototype.writeInt32BE=function(t,r,n){return t=+t,r|=0,n||Io(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),eo.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Bo(this,t,r,!1),r+4},eo.prototype.writeFloatLE=function(t,r,n){return xo(this,t,r,!0,n)},eo.prototype.writeFloatBE=function(t,r,n){return xo(this,t,r,!1,n)},eo.prototype.writeDoubleLE=function(t,r,n){return Co(this,t,r,!0,n)},eo.prototype.writeDoubleBE=function(t,r,n){return Co(this,t,r,!1,n)},eo.prototype.copy=function(t,r,n,e){if(n||(n=0),e||0===e||(e=this.length),r>=t.length&&(r=t.length),r||(r=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(i<1e3||!eo.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&n<57344){if(!o){if(n>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===e){(r-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(r-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((r-=1)<0)break;i.push(n)}else if(n<2048){if((r-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((r-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Do(t){return function(t){var r,n,e,o,i,u;$e||He();var f=t.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[f-2]?2:"="===t[f-1]?1:0,u=new Xe(3*f/4-i),e=i>0?f-4:f;var a=0;for(r=0,n=0;r>16&255,u[a++]=o>>8&255,u[a++]=255&o;return 2===i?(o=Ge[t.charCodeAt(r)]<<2|Ge[t.charCodeAt(r+1)]>>4,u[a++]=255&o):1===i&&(o=Ge[t.charCodeAt(r)]<<10|Ge[t.charCodeAt(r+1)]<<4|Ge[t.charCodeAt(r+2)]>>2,u[a++]=o>>8&255,u[a++]=255&o),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Mo,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function No(t,r,n,e){for(var o=0;o=r.length||o>=t.length);++o)r[o+n]=t[o];return o}function ko(t){return null!=t&&(!!t._isBuffer||Vo(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Vo(t.slice(0,0))}(t))}function Vo(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var zo=t(Object.freeze({__proto__:null,Buffer:eo,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),eo.alloc(+t)},isBuffer:ko,kMaxLength:to})).Buffer,Go=function(){throw new Error("not implemented")},Xo=Ve()?zo:Go,$o=Zt(Xo.from),Ho=Nt,Wo=Xo;var qo=function(t){if(!Ho(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return Wo.from(t)},Jo=Nt,Zo=Xo;var Ko=function(t){if(!Jo(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return new Zo(t)},Qo=$o?qo:Ko;var ti="function"==typeof Int8Array?Int8Array:void 0,ri=function(){throw new Error("not implemented")},ni=A()?ti:ri,ei=y,oi="function"==typeof Uint8Array;var ii="function"==typeof Uint8Array?Uint8Array:null,ui=function(t){return oi&&t instanceof Uint8Array||"[object Uint8Array]"===ei(t)},fi=ii;var ai=function(){var t,r;if("function"!=typeof fi)return!1;try{r=new fi(r=[1,3.14,-3.14,256,257]),t=ui(r)&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var ci="function"==typeof Uint8Array?Uint8Array:void 0,si=function(){throw new Error("not implemented")},li=ai()?ci:si,hi=y,pi="function"==typeof Uint8ClampedArray;var yi="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null,vi=function(t){return pi&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===hi(t)},gi=yi;var wi=function(){var t,r;if("function"!=typeof gi)return!1;try{r=new gi([-1,0,1,3.14,4.99,255,256]),t=vi(r)&&0===r[0]&&0===r[1]&&1===r[2]&&3===r[3]&&5===r[4]&&255===r[5]&&255===r[6]}catch(r){t=!1}return t};var di="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,bi=function(){throw new Error("not implemented")},mi=wi()?di:bi,Ai=y,Ei="function"==typeof Int16Array;var _i="function"==typeof Int16Array?Int16Array:null,Oi=function(t){return Ei&&t instanceof Int16Array||"[object Int16Array]"===Ai(t)},Pi=_i;var ji=function(){var t,r;if("function"!=typeof Pi)return!1;try{r=new Pi([1,3.14,-3.14,32768]),t=Oi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t};var Ri="function"==typeof Int16Array?Int16Array:void 0,Ti=function(){throw new Error("not implemented")},Ui=ji()?Ri:Ti,Ii=y,Si="function"==typeof Uint16Array;var Bi="function"==typeof Uint16Array?Uint16Array:null,Yi=function(t){return Si&&t instanceof Uint16Array||"[object Uint16Array]"===Ii(t)},xi=Bi;var Ci=function(){var t,r;if("function"!=typeof xi)return!1;try{r=new xi(r=[1,3.14,-3.14,65536,65537]),t=Yi(r)&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var Mi="function"==typeof Uint16Array?Uint16Array:void 0,Li=function(){throw new Error("not implemented")},Fi=Ci()?Mi:Li,Di=y,Ni="function"==typeof Int32Array;var ki="function"==typeof Int32Array?Int32Array:null,Vi=function(t){return Ni&&t instanceof Int32Array||"[object Int32Array]"===Di(t)},zi=ki;var Gi=function(){var t,r;if("function"!=typeof zi)return!1;try{r=new zi([1,3.14,-3.14,2147483648]),t=Vi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t};var Xi="function"==typeof Int32Array?Int32Array:void 0,$i=function(){throw new Error("not implemented")},Hi=Gi()?Xi:$i,Wi=y,qi="function"==typeof Uint32Array;var Ji="function"==typeof Uint32Array?Uint32Array:null,Zi=function(t){return qi&&t instanceof Uint32Array||"[object Uint32Array]"===Wi(t)},Ki=Ji;var Qi=function(){var t,r;if("function"!=typeof Ki)return!1;try{r=new Ki(r=[1,3.14,-3.14,4294967296,4294967297]),t=Zi(r)&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var tu="function"==typeof Uint32Array?Uint32Array:void 0,ru=function(){throw new Error("not implemented")},nu=Qi()?tu:ru,eu=y,ou="function"==typeof Float32Array;var iu="function"==typeof Float32Array?Float32Array:null,uu=function(t){return ou&&t instanceof Float32Array||"[object Float32Array]"===eu(t)},fu=Ar,au=iu;var cu=function(){var t,r;if("function"!=typeof au)return!1;try{r=new au([1,3.14,-3.14,5e40]),t=uu(r)&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===fu}catch(r){t=!1}return t};var su="function"==typeof Float32Array?Float32Array:void 0,lu=function(){throw new Error("not implemented")},hu=cu()?su:lu,pu=y,yu="function"==typeof Float64Array;var vu="function"==typeof Float64Array?Float64Array:null,gu=function(t){return yu&&t instanceof Float64Array||"[object Float64Array]"===pu(t)},wu=vu;var du=function(){var t,r;if("function"!=typeof wu)return!1;try{r=new wu([1,3.14,-3.14,NaN]),t=gu(r)&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t};var bu,mu="function"==typeof Float64Array?Float64Array:void 0,Au=function(){throw new Error("not implemented")};bu=du()?mu:Au;var Eu=ni,_u=li,Ou=mi,Pu=Ui,ju=Fi,Ru=Hi,Tu=nu,Uu=hu,Iu=bu;function Su(t){return new Eu(t)}function Bu(t){return new _u(t)}function Yu(t){return new Ou(t)}function xu(t){return new Pu(t)}function Cu(t){return new ju(t)}function Mu(t){return new Ru(t)}function Lu(t){return new Tu(t)}function Fu(t){return new Uu(t)}function Du(t){return new Iu(t)}var Nu=f,ku=Ct,Vu=Nt,zu=cn,Gu=qt,Xu=yn,$u=xn,Hu=Ye,Wu=Le,qu=ke,Ju=un,Zu=C,Ku=Qo,Qu={int8array:Su,uint8array:Bu,uint8clampedarray:Yu,int16array:xu,uint16array:Cu,int32array:Mu,uint32array:Lu,float32array:Fu,float64array:Du};function tf(t,r,n,e,o){var i,u,f,a,c,s,l,h,p,y;if(o-=1,"object"!=typeof t||null===t)return t;if(Vu(t))return Ku(t);if(zu(t))return function(t){var r,n,e,o,i,u,f=[],a=[];for(i=new t.constructor(t.message),f.push(t),a.push(i),t.stack&&(i.stack=t.stack),t.code&&(i.code=t.code),t.errno&&(i.errno=t.errno),t.syscall&&(i.syscall=t.syscall),r=Hu(t),u=0;u0)for(i=f,y=0;y1){if(!nf(r))throw new TypeError("invalid argument. `level` must be a nonnegative integer. Value: `"+r+"`.");if(0===r)return t}else r=ef;return n=rf(t)?new Array(t.length):{},of(t,n,[t],[n],r)},ff=uf,af=Ct;var cf=function(t){return"object"==typeof t&&null!==t&&!af(t)},sf=Zt,lf=un,hf=f,pf=y,yf=Object.prototype;var vf=function(t){var r;return!!cf(t)&&(!(r=lf(t))||!hf(t,"constructor")&&hf(r,"constructor")&&sf(r.constructor)&&"[object Function]"===pf(r.constructor)&&hf(r,"isPrototypeOf")&&sf(r.isPrototypeOf)&&(r===yf||function(t){var r;for(r in t)if(!hf(t,r))return!1;return!0}(t)))},gf=vf,wf=f,df=J.isPrimitive;var bf={url:"https://stdlib.io/docs/api/latest/error-decoder.html",message:"Minified stdlib error code: {{code}}. Visit {{url}} for the full message."},mf=ur,Af=ff,Ef=function(t,r){return gf(r)?wf(r,"url")&&(t.url=r.url,!df(t.url))?new TypeError("invalid option. `url` option must be a string primitive. Option: `"+t.url+"`."):wf(r,"message")&&(t.message=r.message,!df(t.message))?new TypeError("invalid option. `message` option must be a string primitive. Option: `"+t.message+"`."):null:new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.")},_f=bf;var Of=function(t){var r,n;if(r=Af(_f),n=Ef(r,t))throw n;return function(){var t,n,e=arguments[0],o=r.url+"?code="+e;for(n=1;n\n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasSymbols = require( '@stdlib/assert-has-symbol-support' );\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `toStringTag` support.\n*\n* @module @stdlib/assert-has-tostringtag-support\n*\n* @example\n* var hasToStringTagSupport = require( '@stdlib/assert-has-tostringtag-support' );\n*\n* var bool = hasToStringTagSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasToStringTagSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nmodule.exports = toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object has a specified property.\n*\n* @module @stdlib/assert-has-own-property\n*\n* @example\n* var hasOwnProp = require( '@stdlib/assert-has-own-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* bool = hasOwnProp( beep, 'bop' );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasOwnProp = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nmodule.exports = toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar toStringTag = require( './tostringtag.js' );\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* var nativeClass = require( '@stdlib/utils-native-class' );\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar builtin = require( './native_class.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt8Array = require( '@stdlib/assert-is-int8array' );\nvar INT8_MAX = require( '@stdlib/constants-int8-max' );\nvar INT8_MIN = require( '@stdlib/constants-int8-min' );\nvar GlobalInt8Array = require( './int8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* var INT8_MIN = require( '@stdlib/constants-int8-min' );\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int8Array` support.\n*\n* @module @stdlib/assert-has-int8array-support\n*\n* @example\n* var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\n*\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MODULES //\n\nvar defineProperty = require( './define_property.js' );\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nvar main = ( typeof Object.defineProperty === 'function' ) ? Object.defineProperty : null;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 no-underscore-dangle, no-proto */\n\n'use strict';\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an object. Value: `' + obj + '`.' );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. Property descriptor must be an object. Value: `' + descriptor + '`.' );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* var defineProperty = require( '@stdlib/utils-define-property' );\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nvar hasDefinePropertySupport = require( './has_define_property_support.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar defineProperty = require( '@stdlib/utils-define-property' );\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define a non-enumerable read-only property.\n*\n* @module @stdlib/utils-define-nonenumerable-read-only-property\n*\n* @example\n* var setNonEnumerableReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\n\n// MODULES //\n\nvar setNonEnumerableReadOnly = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar valueOf = require( './valueof.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2valueof.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' );\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isObject;\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isString = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isString, 'isPrimitive', isPrimitive );\nsetReadOnly( isString, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string primitive\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Escape a regular expression string or pattern.\n*\n* @module @stdlib/utils-escape-regexp-string\n*\n* @example\n* var rescape = require( '@stdlib/utils-escape-regexp-string' );\n*\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\n\n// MODULES //\n\nvar rescape = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar RE = /./;\n\n\n// EXPORTS //\n\nmodule.exports = RE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* var isBoolean = require( '@stdlib/assert-is-boolean' );\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* // Use interface to check for boolean primitives...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* // Use interface to check for boolean objects...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isObject;\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isBoolean = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isBoolean, 'isPrimitive', isPrimitive );\nsetReadOnly( isBoolean, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof global === 'object' ) ? global : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar getThis = require( './codegen.js' );\nvar Self = require( './self.js' );\nvar Win = require( './window.js' );\nvar Global = require( './global.js' );\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. Must provide a boolean primitive. Value: `'+codegen+'`.' );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: Node.js\n\tif ( Global ) {\n\t\treturn Global;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getGlobal = require( '@stdlib/utils-global' );\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nmodule.exports = nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the global object.\n*\n* @module @stdlib/utils-global\n*\n* @example\n* var getGlobal = require( '@stdlib/utils-global' );\n*\n* var g = getGlobal();\n* // returns {...}\n*/\n\n// MODULES //\n\nvar getGlobal = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar RE = require( './fixtures/re.js' );\nvar nodeList = require( './fixtures/nodelist.js' );\nvar typedarray = require( './fixtures/typedarray.js' );\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* var reFunctionName = require( '@stdlib/regexp-function-name' );\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reFunctionName = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reFunctionName, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar reFunctionName = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nmodule.exports = RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nmodule.exports = f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an array.\n*\n* @module @stdlib/assert-is-array\n*\n* @example\n* var isArray = require( '@stdlib/assert-is-array' );\n*\n* var bool = isArray( [] );\n* // returns true\n*\n* bool = isArray( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isArray = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* var isOdd = require( '@stdlib/assert-is-odd' );\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a function. Value: `' + predicate + '`.' );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' );\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' ).isObjectLikeArray;\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar arrayfun = require( '@stdlib/assert-tools-array-function' );\nvar isObjectLike = require( './main.js' );\n\n\n// MAIN //\n\nsetReadOnly( isObjectLike, 'isObjectLikeArray', arrayfun( isObjectLike ) );\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObjectLike = require( '@stdlib/assert-is-object-like' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a Buffer instance.\n*\n* @module @stdlib/assert-is-buffer\n*\n* @example\n* var isBuffer = require( '@stdlib/assert-is-buffer' );\n*\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* v = isBuffer( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isBuffer = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar RE = require( '@stdlib/regexp-function-name' ).REGEXP;\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine the name of a value's constructor.\n*\n* @module @stdlib/utils-constructor-name\n*\n* @example\n* var constructorName = require( '@stdlib/utils-constructor-name' );\n*\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* v = constructorName( {} );\n* // returns 'Object'\n*\n* v = constructorName( true );\n* // returns 'Boolean'\n*/\n\n// MODULES //\n\nvar constructorName = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* var typeOf = require( '@stdlib/utils-type-of' );\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nvar usePolyfill = require( './check.js' );\nvar typeOf = require( './typeof.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : typeOf;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar typeOf = require( '@stdlib/utils-type-of' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a function.\n*\n* @module @stdlib/assert-is-function\n*\n* @example\n* var isFunction = require( '@stdlib/assert-is-function' );\n*\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\n\n// MODULES //\n\nvar isFunction = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar exec = require( './exec.js' );\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2exec.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar rescape = require( '@stdlib/utils-escape-regexp-string' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isRegExp = require( '@stdlib/assert-is-regexp' );\n\n\n// MAIN //\n\n/**\n* Replace search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string primitive\n* @throws {TypeError} second argument argument must be a string primitive or regular expression\n* @throws {TypeError} third argument must be a string primitive or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* var capitalize = require( '@stdlib/string-capitalize' );\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer);\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be a string primitive. Value: `' + str + '`.' );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = rescape( search );\n\t\tsearch = new RegExp( search, 'g' );\n\t}\n\telse if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( 'invalid argument. Second argument must be a string primitive or regular expression. Value: `' + search + '`.' );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( 'invalid argument. Third argument must be a string primitive or replacement function. Value: `' + newval + '`.' );\n\t}\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Replace search occurrences with a replacement string.\n*\n* @module @stdlib/string-replace\n*\n* @example\n* var replace = require( '@stdlib/string-replace' );\n*\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* str = 'Hello World';\n* out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*/\n\n// MODULES //\n\nvar replace = require( './replace.js' );\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Constructor which returns a `Number` object.\n*\n* @module @stdlib/number-ctor\n*\n* @example\n* var Number = require( '@stdlib/number-ctor' );\n*\n* var v = new Number( 10.0 );\n* // returns \n*/\n\n// MODULES //\n\nvar Number = require( './number.js' );\n\n\n// EXPORTS //\n\nmodule.exports = Number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// EXPORTS //\n\nmodule.exports = Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar Number = require( '@stdlib/number-ctor' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' );\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isObject;\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNumber = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNumber, 'isPrimitive', isPrimitive );\nsetReadOnly( isNumber, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* var FLOAT64_PINF = require( '@stdlib/constants-float64-pinf' );\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* var FLOAT64_NINF = require( '@stdlib/constants-float64-ninf' );\n* // returns -Infinity\n*/\n\n// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar floor = require( '@stdlib/math-base-special-floor' );\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nmodule.exports = floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a finite double-precision floating-point number is an integer.\n*\n* @module @stdlib/math-base-assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/math-base-assert-is-integer' );\n*\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* bool = isInteger( 3.14 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isInteger = require( './is_integer.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar isInt = require( '@stdlib/math-base-assert-is-integer' );\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/assert-is-integer' );\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' );\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isObject;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNonNegativeInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNonNegativeInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isNonNegativeInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar getProto = require( './proto.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar builtin = require( './native.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getProto = require( './detect.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the prototype of a provided object.\n*\n* @module @stdlib/utils-get-prototype-of\n*\n* @example\n* var getPrototype = require( '@stdlib/utils-get-prototype-of' );\n*\n* var proto = getPrototype( {} );\n* // returns {}\n*/\n\n// MODULES //\n\nvar getPrototype = require( './get_prototype_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an `Error` object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `Error` object\n*\n* @example\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isError( {} );\n* // returns false\n*/\nfunction isError( value ) {\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tif ( value instanceof Error ) {\n\t\treturn true;\n\t}\n\t// Walk the prototype tree until we find an object having the desired native class...\n\twhile ( value ) {\n\t\tif ( nativeClass( value ) === '[object Error]' ) {\n\t\t\treturn true;\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `Error` object.\n*\n* @module @stdlib/assert-is-error\n*\n* @example\n* var isError = require( '@stdlib/assert-is-error' );\n*\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* bool = isError( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isError = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 a regular expression to parse a regular expression string.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*/\nfunction reRegExp() {\n\treturn /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/; // eslint-disable-line no-useless-escape\n}\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 regular expression to parse a regular expression string.\n*\n* @module @stdlib/regexp-regexp\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var parts = RE_REGEXP.exec( '/^.*$/ig' );\n* // returns [ '/^.*$/ig', '^.*$', 'ig', 'index': 0, 'input': '/^.*$/ig' ]\n*/\n\n// MAIN //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reRegExp = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reRegExp, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar reRegExp = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Matches parts of a regular expression string.\n*\n* Regular expression: `/^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/`\n*\n* - `/^\\/`\n* - match a string that begins with a `/`\n*\n* - `()`\n* - capture\n*\n* - `(?:)+`\n* - capture, but do not remember, a group of characters which occur one or more times\n*\n* - `\\\\\\/`\n* - match the literal `\\/`\n*\n* - `|`\n* - OR\n*\n* - `[^\\/]`\n* - anything which is not the literal `\\/`\n*\n* - `\\/`\n* - match the literal `/`\n*\n* - `([imgy]*)`\n* - capture any characters matching `imgy` occurring zero or more times\n*\n* - `$/`\n* - string end\n*\n*\n* @constant\n* @type {RegExp}\n* @default /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/\n*/\nvar RE_REGEXP = reRegExp();\n\n\n// EXPORTS //\n\nmodule.exports = RE_REGEXP;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar reRegExp = require( '@stdlib/regexp-regexp' );\n\n\n// MAIN //\n\n/**\n* Parses a regular expression string and returns a new regular expression.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} must provide a regular expression string\n* @returns {(RegExp|null)} regular expression or null\n*\n* @example\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\nfunction reFromString( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Capture the regular expression pattern and any flags:\n\tstr = reRegExp().exec( str );\n\n\t// Create a new regular expression:\n\treturn ( str ) ? new RegExp( str[1], str[2] ) : null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Create a regular expression from a regular expression string.\n*\n* @module @stdlib/utils-regexp-from-string\n*\n* @example\n* var reFromString = require( '@stdlib/utils-regexp-from-string' );\n*\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\n\n// MODULES //\n\nvar reFromString = require( './from_string.js' );\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a double-precision floating-point numeric value is `NaN`.\n*\n* @module @stdlib/math-base-assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/math-base-assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 7.0 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isnan = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is `NaN`.\n*\n* @module @stdlib/assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isObject;\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isnan = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isnan, 'isPrimitive', isPrimitive );\nsetReadOnly( isnan, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isCollection;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isnan = require( '@stdlib/assert-is-nan' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} `fromIndex` must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array-like object. Value: `' + arr + '`.' );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `fromIndex` must be an integer. Value: `' + fromIndex + '`.' );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* var MAX_TYPED_ARRAY_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nmodule.exports = MAX_TYPED_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the first index at which a given element can be found.\n*\n* @module @stdlib/utils-index-of\n*\n* @example\n* var indexOf = require( '@stdlib/utils-index-of' );\n*\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* arr = [ 4, 3, 2, 1 ];\n* idx = indexOf( arr, 5 );\n* // returns -1\n*\n* // Using a `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* // `fromIndex` which exceeds `array` length:\n* arr = [ 1, 2, 3, 4, 2, 5 ];\n* idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* // Negative `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* // Negative `fromIndex` exceeding input `array` length:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* // Array-like objects:\n* var str = 'bebop';\n* idx = indexOf( str, 'o' );\n* // returns 3\n*/\n\n// MODULES //\n\nvar indexOf = require( './index_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar keys = require( './builtin.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.keys !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArguments = require( './main.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnum = require( './native.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' );\nvar isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isEnum = require( './native.js' );\nvar hasStringEnumBug = require( './has_string_enumerability_bug.js' );\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object's own property is enumerable.\n*\n* @module @stdlib/assert-is-enumerable-property\n*\n* @example\n* var isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\n\n// MODULES //\n\nvar isEnumerableProperty = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-uint32-max' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* var isArguments = require( '@stdlib/assert-is-arguments' );\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasArgumentsClass = require( './detect.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar builtin = require( './builtin.js' );\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nmodule.exports = noop;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar noop = require( '@stdlib/utils-noop' );\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isConstructorPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar EXCLUDED_KEYS = require( './excluded_keys.json' );\nvar win = require( './window.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nmodule.exports = w;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof window !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasAutomationEqualityBug = require( './has_automation_equality_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar HAS_WINDOW = require( './has_window.js' );\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = wrapper;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObjectLike = require( '@stdlib/assert-is-object-like' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar HAS_ENUM_PROTO_BUG = require( './has_enumerable_prototype_bug.js' );\nvar HAS_NON_ENUM_PROPS_BUG = require( './has_non_enumerable_properties_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype_wrapper.js' );\nvar NON_ENUMERABLE = require( './non_enumerable.json' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasArgumentsBug = require( './has_arguments_bug.js' );\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar wrapper = require( './builtin_wrapper.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an array of an object's own enumerable property names.\n*\n* @module @stdlib/utils-keys\n*\n* @example\n* var keys = require( '@stdlib/utils-keys' );\n*\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\n\n// MODULES //\n\nvar keys = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.getOwnPropertyNames !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyNames = Object.getOwnPropertyNames;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn propertyNames( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar keys = require( '@stdlib/utils-keys' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n* - In environments lacking support for `Object.getOwnPropertyNames()`, property descriptors are unavailable, and thus all properties can be safely assumed to be enumerable. Hence, we can defer to calling `Object.keys`, which retrieves all own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an array of an object's own enumerable and non-enumerable property names.\n*\n* @module @stdlib/utils-property-names\n*\n* @example\n* var getOwnPropertyNames = require( '@stdlib/utils-property-names' );\n*\n* var keys = getOwnPropertyNames({\n* 'foo': 'bar',\n* 'beep': 'boop'\n* });\n* // e.g., returns [ 'foo', 'beep' ]\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.getOwnPropertyDescriptor !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyDescriptor = Object.getOwnPropertyDescriptor;\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tvar desc;\n\tif ( value === null || value === void 0 ) {\n\t\treturn null;\n\t}\n\tdesc = propertyDescriptor( value, property );\n\treturn ( desc === void 0 ) ? null : desc;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n* - In environments lacking `Object.getOwnPropertyDescriptor()` support, property descriptors do not exist. In non-supporting environment, if an object has a provided property, this function returns a descriptor object equivalent to that returned in a supporting environment; otherwise, the function returns `null`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tif ( hasOwnProp( value, property ) ) {\n\t\treturn {\n\t\t\t'configurable': true,\n\t\t\t'enumerable': true,\n\t\t\t'writable': true,\n\t\t\t'value': value[ property ]\n\t\t};\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 property descriptor for an object's own property.\n*\n* @module @stdlib/utils-property-descriptor\n*\n* @example\n* var getOwnPropertyDescriptor = require( '@stdlib/utils-property-descriptor' );\n*\n* var obj = {\n* 'foo': 'bar',\n* 'beep': 'boop'\n* };\n*\n* var keys = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':'bar'}\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write (browser) polyfill\n\n// MAIN //\n\n/**\n* Buffer constructor.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Buffer constructor.\n*\n* @module @stdlib/buffer-ctor\n*\n* @example\n* var ctor = require( '@stdlib/buffer-ctor' );\n*\n* var b = new ctor( [ 1, 2, 3, 4 ] );\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\nvar main = require( './buffer.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasNodeBufferSupport() ) {\n\tctor = main;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = require( 'buffer' ).Buffer; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn Buffer.from( buffer );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn new Buffer( buffer ); // eslint-disable-line no-buffer-constructor\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy buffer data to a new `Buffer` instance.\n*\n* @module @stdlib/buffer-from-buffer\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n* var copyBuffer = require( '@stdlib/buffer-from-buffer' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = copyBuffer( b1 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFrom = require( './has_from.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar copyBuffer;\nif ( hasFrom ) {\n\tcopyBuffer = main;\n} else {\n\tcopyBuffer = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = copyBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './int8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint8Array = require( '@stdlib/assert-is-uint8array' );\nvar UINT8_MAX = require( '@stdlib/constants-uint8-max' );\nvar GlobalUint8Array = require( './uint8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\nvar builtin = require( './uint8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8Array` support.\n*\n* @module @stdlib/assert-has-uint8array-support\n*\n* @example\n* var hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\n*\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8ClampedArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint8ClampedArray = require( '@stdlib/assert-is-uint8clampedarray' );\nvar GlobalUint8ClampedArray = require( './uint8clampedarray.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @module @stdlib/array-uint8c\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8c' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' ); // eslint-disable-line id-length\nvar builtin = require( './uint8clampedarray.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8ClampedArray` support.\n*\n* @module @stdlib/assert-has-uint8clampedarray-support\n*\n* @example\n* var hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' );\n*\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt16Array = require( '@stdlib/assert-is-int16array' );\nvar INT16_MAX = require( '@stdlib/constants-int16-max' );\nvar INT16_MIN = require( '@stdlib/constants-int16-min' );\nvar GlobalInt16Array = require( './int16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-min\n* @type {integer32}\n*\n* @example\n* var INT16_MIN = require( '@stdlib/constants-int16-min' );\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT16_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int16\n*\n* @example\n* var ctor = require( '@stdlib/array-int16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\nvar builtin = require( './int16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int16Array === 'function' ) ? Int16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int16Array` support.\n*\n* @module @stdlib/assert-has-int16array-support\n*\n* @example\n* var hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\n*\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint16Array = require( '@stdlib/assert-is-uint16array' );\nvar UINT16_MAX = require( '@stdlib/constants-uint16-max' );\nvar GlobalUint16Array = require( './uint16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 16-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint16\n*\n* @example\n* var ctor = require( '@stdlib/array-uint16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\nvar builtin = require( './uint16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint16Array === 'function' ) ? Uint16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint16Array` support.\n*\n* @module @stdlib/assert-has-uint16array-support\n*\n* @example\n* var hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\n*\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt32Array = require( '@stdlib/assert-is-int32array' );\nvar INT32_MAX = require( '@stdlib/constants-int32-max' );\nvar INT32_MIN = require( '@stdlib/constants-int32-min' );\nvar GlobalInt32Array = require( './int32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-min\n* @type {integer32}\n*\n* @example\n* var INT32_MIN = require( '@stdlib/constants-int32-min' );\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT32_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int32\n*\n* @example\n* var ctor = require( '@stdlib/array-int32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\nvar builtin = require( './int32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int32Array === 'function' ) ? Int32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int32Array` support.\n*\n* @module @stdlib/assert-has-int32array-support\n*\n* @example\n* var hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\n*\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint32Array = require( '@stdlib/assert-is-uint32array' );\nvar UINT32_MAX = require( '@stdlib/constants-uint32-max' );\nvar GlobalUint32Array = require( './uint32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 32-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint32\n*\n* @example\n* var ctor = require( '@stdlib/array-uint32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\nvar builtin = require( './uint32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint32Array === 'function' ) ? Uint32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint32Array` support.\n*\n* @module @stdlib/assert-has-uint32array-support\n*\n* @example\n* var hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\n*\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFloat32Array = require( '@stdlib/assert-is-float32array' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar GlobalFloat32Array = require( './float32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of single-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float32\n*\n* @example\n* var ctor = require( '@stdlib/array-float32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\nvar builtin = require( './float32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Float32Array === 'function' ) ? Float32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float32Array` support.\n*\n* @module @stdlib/assert-has-float32array-support\n*\n* @example\n* var hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\n*\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat64Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFloat64Array = require( '@stdlib/assert-is-float64array' );\nvar GlobalFloat64Array = require( './float64array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float64\n*\n* @example\n* var ctor = require( '@stdlib/array-float64' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\nvar builtin = require( './float64array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Float64Array === 'function' ) ? Float64Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float64Array` support.\n*\n* @module @stdlib/assert-has-float64array-support\n*\n* @example\n* var hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\n*\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Int8Array = require( '@stdlib/array-int8' );\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar Uint8ClampedArray = require( '@stdlib/array-uint8c' );\nvar Int16Array = require( '@stdlib/array-int16' );\nvar Uint16Array = require( '@stdlib/array-uint16' );\nvar Int32Array = require( '@stdlib/array-int32' );\nvar Uint32Array = require( '@stdlib/array-uint32' );\nvar Float32Array = require( '@stdlib/array-float32' );\nvar Float64Array = require( '@stdlib/array-float64' );\n\n\n// VARIABLES //\n\nvar hash;\n\n\n// FUNCTIONS //\n\n/**\n* Copies an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - array to copy\n* @returns {Int8Array} new array\n*/\nfunction int8array( arr ) {\n\treturn new Int8Array( arr );\n}\n\n/**\n* Copies a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - array to copy\n* @returns {Uint8Array} new array\n*/\nfunction uint8array( arr ) {\n\treturn new Uint8Array( arr );\n}\n\n/**\n* Copies a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - array to copy\n* @returns {Uint8ClampedArray} new array\n*/\nfunction uint8clampedarray( arr ) {\n\treturn new Uint8ClampedArray( arr );\n}\n\n/**\n* Copies an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - array to copy\n* @returns {Int16Array} new array\n*/\nfunction int16array( arr ) {\n\treturn new Int16Array( arr );\n}\n\n/**\n* Copies a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - array to copy\n* @returns {Uint16Array} new array\n*/\nfunction uint16array( arr ) {\n\treturn new Uint16Array( arr );\n}\n\n/**\n* Copies an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - array to copy\n* @returns {Int32Array} new array\n*/\nfunction int32array( arr ) {\n\treturn new Int32Array( arr );\n}\n\n/**\n* Copies a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - array to copy\n* @returns {Uint32Array} new array\n*/\nfunction uint32array( arr ) {\n\treturn new Uint32Array( arr );\n}\n\n/**\n* Copies a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - array to copy\n* @returns {Float32Array} new array\n*/\nfunction float32array( arr ) {\n\treturn new Float32Array( arr );\n}\n\n/**\n* Copies a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - array to copy\n* @returns {Float64Array} new array\n*/\nfunction float64array( arr ) {\n\treturn new Float64Array( arr );\n}\n\n/**\n* Returns a hash of functions for copying typed arrays.\n*\n* @private\n* @returns {Object} function hash\n*/\nfunction typedarrays() {\n\tvar out = {\n\t\t'int8array': int8array,\n\t\t'uint8array': uint8array,\n\t\t'uint8clampedarray': uint8clampedarray,\n\t\t'int16array': int16array,\n\t\t'uint16array': uint16array,\n\t\t'int32array': int32array,\n\t\t'uint32array': uint32array,\n\t\t'float32array': float32array,\n\t\t'float64array': float64array\n\t};\n\treturn out;\n}\n\n\n// MAIN //\n\nhash = typedarrays();\n\n\n// EXPORTS //\n\nmodule.exports = hash;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar regexp = require( '@stdlib/utils-regexp-from-string' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar propertyNames = require( '@stdlib/utils-property-names' );\nvar propertyDescriptor = require( '@stdlib/utils-property-descriptor' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar defineProperty = require( '@stdlib/utils-define-property' );\nvar copyBuffer = require( '@stdlib/buffer-from-buffer' );\nvar typedArrays = require( './typed_arrays.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Clones a class instance.\n*\n* ## Notes\n*\n* - This should **only** be used for simple cases. Any instances with privileged access to variables (e.g., within closures) cannot be cloned. This approach should be considered **fragile**.\n* - The function is greedy, disregarding the notion of a `level`. Instead, the function deep copies all properties, as we assume the concept of `level` applies only to the class instance reference but not to its internal state. This prevents, in theory, two instances from sharing state.\n*\n*\n* @private\n* @param {Object} val - class instance\n* @returns {Object} new instance\n*/\nfunction cloneInstance( val ) {\n\tvar cache;\n\tvar names;\n\tvar name;\n\tvar refs;\n\tvar desc;\n\tvar tmp;\n\tvar ref;\n\tvar i;\n\n\tcache = [];\n\trefs = [];\n\n\tref = Object.create( getPrototypeOf( val ) );\n\tcache.push( val );\n\trefs.push( ref );\n\n\tnames = propertyNames( val );\n\tfor ( i = 0; i < names.length; i++ ) {\n\t\tname = names[ i ];\n\t\tdesc = propertyDescriptor( val, name );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( val[name] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( val[name], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( ref, name, desc );\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( ref );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( ref );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( ref );\n\t}\n\treturn ref;\n}\n\n/**\n* Copies an error object.\n*\n* @private\n* @param {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error - error to copy\n* @returns {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error copy\n*\n* @example\n* var err1 = new TypeError( 'beep' );\n*\n* var err2 = copyError( err1 );\n* // returns \n*/\nfunction copyError( error ) {\n\tvar cache = [];\n\tvar refs = [];\n\tvar keys;\n\tvar desc;\n\tvar tmp;\n\tvar key;\n\tvar err;\n\tvar i;\n\n\t// Create a new error...\n\terr = new error.constructor( error.message );\n\n\tcache.push( error );\n\trefs.push( err );\n\n\t// If a `stack` property is present, copy it over...\n\tif ( error.stack ) {\n\t\terr.stack = error.stack;\n\t}\n\t// Node.js specific (system errors)...\n\tif ( error.code ) {\n\t\terr.code = error.code;\n\t}\n\tif ( error.errno ) {\n\t\terr.errno = error.errno;\n\t}\n\tif ( error.syscall ) {\n\t\terr.syscall = error.syscall;\n\t}\n\t// Any enumerable properties...\n\tkeys = objectKeys( error );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tdesc = propertyDescriptor( error, key );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( error[ key ] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( error[ key ], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( err, key, desc );\n\t}\n\treturn err;\n}\n\n\n// MAIN //\n\n/**\n* Recursively performs a deep copy of an input object.\n*\n* @private\n* @param {*} val - value to copy\n* @param {(Array|Object)} copy - copy\n* @param {Array} cache - an array of visited objects\n* @param {Array} refs - an array of object references\n* @param {NonNegativeInteger} level - copy depth\n* @returns {*} deep copy\n*/\nfunction deepCopy( val, copy, cache, refs, level ) {\n\tvar parent;\n\tvar keys;\n\tvar name;\n\tvar desc;\n\tvar ctor;\n\tvar key;\n\tvar ref;\n\tvar x;\n\tvar i;\n\tvar j;\n\n\tlevel -= 1;\n\n\t// Primitives and functions...\n\tif (\n\t\ttypeof val !== 'object' ||\n\t\tval === null\n\t) {\n\t\treturn val;\n\t}\n\tif ( isBuffer( val ) ) {\n\t\treturn copyBuffer( val );\n\t}\n\tif ( isError( val ) ) {\n\t\treturn copyError( val );\n\t}\n\t// Objects...\n\tname = typeOf( val );\n\n\tif ( name === 'date' ) {\n\t\treturn new Date( +val );\n\t}\n\tif ( name === 'regexp' ) {\n\t\treturn regexp( val.toString() );\n\t}\n\tif ( name === 'set' ) {\n\t\treturn new Set( val );\n\t}\n\tif ( name === 'map' ) {\n\t\treturn new Map( val );\n\t}\n\tif (\n\t\tname === 'string' ||\n\t\tname === 'boolean' ||\n\t\tname === 'number'\n\t) {\n\t\t// If provided an `Object`, return an equivalent primitive!\n\t\treturn val.valueOf();\n\t}\n\tctor = typedArrays[ name ];\n\tif ( ctor ) {\n\t\treturn ctor( val );\n\t}\n\t// Class instances...\n\tif (\n\t\tname !== 'array' &&\n\t\tname !== 'object'\n\t) {\n\t\t// Cloning requires ES5 or higher...\n\t\tif ( typeof Object.freeze === 'function' ) {\n\t\t\treturn cloneInstance( val );\n\t\t}\n\t\treturn {};\n\t}\n\t// Arrays and plain objects...\n\tkeys = objectKeys( val );\n\tif ( level > 0 ) {\n\t\tparent = name;\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tx = val[ key ];\n\n\t\t\t// Primitive, Buffer, special class instance...\n\t\t\tname = typeOf( x );\n\t\t\tif (\n\t\t\t\ttypeof x !== 'object' ||\n\t\t\t\tx === null ||\n\t\t\t\t(\n\t\t\t\t\tname !== 'array' &&\n\t\t\t\t\tname !== 'object'\n\t\t\t\t) ||\n\t\t\t\tisBuffer( x )\n\t\t\t) {\n\t\t\t\tif ( parent === 'object' ) {\n\t\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\t\tdesc.value = deepCopy( x );\n\t\t\t\t\t}\n\t\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t\t} else {\n\t\t\t\t\tcopy[ key ] = deepCopy( x );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Circular reference...\n\t\t\ti = indexOf( cache, x );\n\t\t\tif ( i !== -1 ) {\n\t\t\t\tcopy[ key ] = refs[ i ];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Plain array or object...\n\t\t\tref = ( isArray( x ) ) ? new Array( x.length ) : {};\n\t\t\tcache.push( x );\n\t\t\trefs.push( ref );\n\t\t\tif ( parent === 'array' ) {\n\t\t\t\tcopy[ key ] = deepCopy( x, ref, cache, refs, level );\n\t\t\t} else {\n\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\tdesc.value = deepCopy( x, ref, cache, refs, level );\n\t\t\t\t}\n\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t}\n\t\t}\n\t} else if ( name === 'array' ) {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tcopy[ key ] = val[ key ];\n\t\t}\n\t} else {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\tdefineProperty( copy, key, desc );\n\t\t}\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( copy );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( copy );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( copy );\n\t}\n\treturn copy;\n}\n\n\n// EXPORTS //\n\nmodule.exports = deepCopy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar deepCopy = require( './deep_copy.js' );\n\n\n// MAIN //\n\n/**\n* Copies or deep clones a value to an arbitrary depth.\n*\n* @param {*} value - value to copy\n* @param {NonNegativeInteger} [level=+infinity] - copy depth\n* @throws {TypeError} `level` must be a nonnegative integer\n* @returns {*} value copy\n*\n* @example\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ { 'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\nfunction copy( value, level ) {\n\tvar out;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( level ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `level` must be a nonnegative integer. Value: `' + level + '`.' );\n\t\t}\n\t\tif ( level === 0 ) {\n\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tlevel = PINF;\n\t}\n\tout = ( isArray( value ) ) ? new Array( value.length ) : {};\n\treturn deepCopy( value, out, [value], [out], level );\n}\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy or deep clone a value to an arbitrary depth.\n*\n* @module @stdlib/utils-copy\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ {'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\n\n// MODULES //\n\nvar copy = require( './copy.js' );\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {(Error|null)} error object or null\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );\n\t}\n\tif ( hasOwnProp( options, 'url' ) ) {\n\t\topts.url = options.url;\n\t\tif ( !isString( opts.url ) ) {\n\t\t\treturn new TypeError( 'invalid option. `url` option must be a string primitive. Option: `' + opts.url + '`.' );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'message' ) ) {\n\t\topts.message = options.message;\n\t\tif ( !isString( opts.message ) ) {\n\t\t\treturn new TypeError( 'invalid option. `message` option must be a string primitive. Option: `' + opts.message + '`.' );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a plain object.\n*\n* @module @stdlib/assert-is-plain-object\n*\n* @example\n* var isPlainObject = require( '@stdlib/assert-is-plain-object' );\n*\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* bool = isPlainObject( null );\n* // returns false\n*/\n\n// MODULES //\n\nvar isPlainObject = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar replace = require( '@stdlib/string-replace' );\nvar copy = require( '@stdlib/utils-copy' );\nvar validate = require( './validate.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function which formats an error message for production.\n*\n* @param {Options} options - function options\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {Function} error formatting function\n*\n* @example\n* var opts = {\n* 'url': 'https://stdlib.io/error-decoder.html'\n* };\n*\n* var fcn = factory( opts );\n* // returns \n*/\nfunction factory( options ) {\n\tvar opts;\n\tvar err;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\treturn formatProdErrorMessage;\n\n\t/**\n\t* Formats an error message for production.\n\t*\n\t* @private\n\t* @param {string} code - error code\n\t* @param {*} ...args - error message arguments\n\t* @returns {string} formatted error message\n\t*/\n\tfunction formatProdErrorMessage() {\n\t\tvar code = arguments[ 0 ];\n\t\tvar url = opts.url + '?code='+code;\n\t\tvar msg;\n\t\tvar i;\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\turl += '&arg[]=' + encodeURIComponent( arguments[ i ] );\n\t\t}\n\t\tmsg = replace( opts.message, '{{url}}', url );\n\t\tmsg = replace( msg, '{{code}}', code );\n\t\treturn msg;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Format an error message for production.\n*\n* @module @stdlib/error-tools-fmtprodmsg\n*\n* @example\n* var formatProdErrorMessage = require( '@stdlib/error-tools-fmtprodmsg' );\n*\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar formatProdErrorMessage = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( formatProdErrorMessage, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar factory = require( './factory.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @name formatProdErrorMessage\n* @type {Function}\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\nvar formatProdErrorMessage = factory( defaults );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","hasSymbols","lib","toStringTag","tostring","Object","prototype","toString","toStr","require$$0","native_class","v","call","has","hasOwnProperty","value","property","toStrTag","hasOwnProp","require$$2","builtin","require$$1","polyfill","isOwn","tag","out","err","nativeClass","hasInt8Array","Int8Array","main","isInt8Array","GlobalInt8Array","bool","arr","INT8_MAX","ctor","defineProperty","has_define_property_support","objectProtoype","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","obj","prop","descriptor","hasValue","hasGet","hasSet","TypeError","__proto__","Error","get","set","configurable","enumerable","writable","primitive","valueOf","String","test","object","isPrimitive","isObject","setReadOnly","isString","require$$3","RE_CHARS","str","s","i","length","replace","substring","re","Boolean","isBoolean","codegen","Function","self_1","self","window_1","window","global","module","exports","getThis","Self","Win","Global","arguments","root","nodeList","document","childNodes","typedarray","RE","check_1","reFunctionName","Array","isArray","isObjectLike","predicate","len","arrayfun","_isBuffer","constructor","isBuffer","REGEXP","match","name","slice","exec","ctorName","typeOf","type","toLowerCase","RegExp","rescape","isFunction","isRegExp","search","newval","Number","isNumber","POSITIVE_INFINITY","NEGATIVE_INFINITY","floor","Math","x","PINF","NINF","isInt","integer","isInteger","isNonNegativeInteger","getProto","getPrototypeOf","proto","reRegExp","isNan","isnan","isCollection","index_of","searchElement","fromIndex","keys","has_arguments_bug","has_builtin","isArguments","bool$8","detect","detect_1","native","propertyIsEnumerable","bool$7","isEnum","hasStringEnumBug","isEnumerableProperty","require$$4","builtin_wrapper","has_enumerable_prototype_bug","has_non_enumerable_properties_bug","is_constructor_prototype","w","indexOf","isConstructorPrototype","EXCLUDED_KEYS","win","bool$4","k","check","hasAutomationEqualityBug","HAS_WINDOW","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","error","NON_ENUMERABLE","wrapper","skipConstructor","skipPrototype","isFcn","p","push","getOwnPropertyNames","propertyNames","getOwnPropertyDescriptor","propertyDescriptor","desc","Buffer","from","buffer","hasUint8Array","Uint8Array","isUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ClampedArray","Uint8ClampedArray","isUint8ClampedArray","GlobalUint8ClampedArray","hasInt16Array","Int16Array","isInt16Array","GlobalInt16Array","INT16_MAX","hasUint16Array","Uint16Array","isUint16Array","GlobalUint16Array","UINT16_MAX","hasInt32Array","Int32Array","isInt32Array","GlobalInt32Array","INT32_MAX","hasUint32Array","Uint32Array","isUint32Array","GlobalUint32Array","UINT32_MAX","hasFloat32Array","Float32Array","isFloat32Array","GlobalFloat32Array","hasFloat64Array","Float64Array","isFloat64Array","GlobalFloat64Array","NaN","require$$5","require$$6","require$$7","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","isError","regexp","objectKeys","require$$8","require$$9","require$$10","require$$11","copyBuffer","require$$12","typedArrays","deepCopy","val","copy","cache","refs","level","parent","key","ref","j","tmp","message","stack","code","errno","syscall","copyError","Date","Set","Map","freeze","names","create","isExtensible","preventExtensions","isSealed","seal","isFrozen","cloneInstance","copy_1","objectPrototype","isPrototypeOf","ownProps","validate","opts","options","url","defaults","factory_1","msg","encodeURIComponent","formatProdErrorMessage","hasInt8ArraySupport","format"],"mappings":";+kBAyCA,ICdIA,EDIJ,WACC,MACmB,mBAAXC,QACoB,iBAApBA,OAAQ,OCPPC,GAqBV,ICTAC,EDEA,WACC,OAASH,GAAqC,iBAAvBC,OAAOG,aEf/BC,EALYC,OAAOC,UAAUC,SCAzBC,EAAQC,EAiCZ,IAAAC,EAPA,SAAsBC,GACrB,OAAOH,EAAMI,KAAMD,IC3BhBE,EAAMR,OAAOC,UAAUQ,eAyC3B,ICjBAZ,EDIA,SAAqBa,EAAOC,GAC3B,OACCD,SAKMF,EAAID,KAAMG,EAAOC,IEnCrBC,EAA+B,mBAAXjB,OAA0BA,OAAOG,YAAc,GCAnEe,EAAaT,EACbN,EDIac,ECHbT,EAAQW,EAwDZ,ICpCIC,EAAUC,EACVC,EDKJ,SAAsBX,GACrB,IAAIY,EACAC,EACAC,EAEJ,GAAKd,QACJ,OAAOH,EAAMI,KAAMD,GAEpBa,EAAMb,EAAGR,GACToB,EAAQL,EAAYP,EAAGR,GAGvB,IACCQ,EAAGR,QAAgB,EAClB,MAAQuB,GACT,OAAOlB,EAAMI,KAAMD,GASpB,OAPAc,EAAMjB,EAAMI,KAAMD,GAEbY,EACJZ,EAAGR,GAAgBqB,SAEZb,EAAGR,GAEJsB,GCdRvB,EAjBqBO,IASNa,EAEAF,EChCXO,EAAclB,EAKdmB,EAAsC,mBAAdC,UA6B5B,IClCIC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EFwBJ,SAAsBhB,GACrB,OACGa,GAAgBb,aAAiBc,WACV,uBAAzBF,EAAaZ,IExBXiB,EDEaF,ECsCjB,IAAAA,EA1BA,WACC,IAAIG,EACAC,EAEJ,GAAgC,mBAApBF,EACX,OAAO,EAGR,IACCE,EAAM,IAAIF,EAAiB,CAAE,EAAG,MAAO,KAAMG,MAC7CF,EACCF,EAAaG,IACA,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEpBR/B,EAL0BO,ECZtB2B,EAA8B,mBAAdP,UAA6BA,eAAY,ECAzDQ,ECA0C,mBAA1BhC,OAAOgC,eAAkChC,OAAOgC,eAAiB,KD4BrF,IAAAC,EAbA,WAEC,IAEC,OADAD,EAAgB,GAAI,IAAK,KAClB,EACN,MAAQX,GACT,OAAO,IEiBTN,EALqBf,OAAOgC,eC/BxBE,EAAiBlC,OAAOC,UACxBE,EAAQ+B,EAAehC,SACvBiC,EAAeD,EAAeE,iBAC9BC,EAAeH,EAAeI,iBAC9BC,EAAeL,EAAeM,iBAC9BC,EAAeP,EAAeQ,iBAuFlC,IAAAzB,EAnDA,SAAyB0B,EAAKC,EAAMC,GACnC,IAAI5C,EACA6C,EACAC,EACAC,EAEJ,GAAoB,iBAARL,GAA4B,OAARA,GAAsC,mBAAtBxC,EAAMI,KAAMoC,GAC3D,MAAM,IAAIM,UAAW,+DAAiEN,EAAM,MAE7F,GAA2B,iBAAfE,GAA0C,OAAfA,GAAoD,mBAA7B1C,EAAMI,KAAMsC,GACzE,MAAM,IAAII,UAAW,oEAAsEJ,EAAa,MAyBzG,IAvBAC,EAAa,UAAWD,KAGtBN,EAAahC,KAAMoC,EAAKC,IACxBH,EAAalC,KAAMoC,EAAKC,IAGxB3C,EAAY0C,EAAIO,UAChBP,EAAIO,UAAYhB,SAGTS,EAAKC,GACZD,EAAKC,GAASC,EAAWnC,MAGzBiC,EAAIO,UAAYjD,GAEhB0C,EAAKC,GAASC,EAAWnC,OAG3BqC,EAAW,QAASF,EACpBG,EAAW,QAASH,EAEfC,IAAcC,GAAUC,GAC5B,MAAM,IAAIG,MAAO,wHASlB,OANKJ,GAAUZ,GACdA,EAAa5B,KAAMoC,EAAKC,EAAMC,EAAWO,KAErCJ,GAAUX,GACdA,EAAa9B,KAAMoC,EAAKC,EAAMC,EAAWQ,KAEnCV,GCrEJ5B,EAAUC,EACVC,EAAWH,EAefjB,EAjB+BO,IASbW,EAEAE,EC7Bde,EAAiB5B,EAmCrB,IAAAqB,EAZA,SAAmCkB,EAAKC,EAAMlC,GAC7CsB,EAAgBW,EAAKC,EAAM,CAC1BU,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ9C,MAASA,KCJXb,EAL+BO,ECA/B,IAAAqD,EAPA,SAAmB/C,GAClB,MAA0B,iBAAVA,GCbbgD,ECDUC,OAAO1D,UAAUyD,QDyB/B,IEvBIpC,EAAcN,EACd4C,EFUJ,SAAelD,GACd,IAEC,OADAgD,EAAQnD,KAAMG,IACP,EACN,MAAQW,GACT,OAAO,IEVL3B,EAPiBU,IA0CrB,IAAAyD,EAhBA,SAAmBnD,GAClB,MAAsB,iBAAVA,IACNA,aAAiBiD,SAGjBjE,EACGkE,EAAMlD,GAEoB,oBAAzBY,EAAaZ,MClCpBoD,EAAc1D,EACd2D,EAAW/C,EA0Bf,ICSIgD,EAAc5D,EACd6D,EDjBJ,SAAmBvD,GAClB,OAASoD,EAAapD,IAAWqD,EAAUrD,ICkBxCqD,EAAWG,EAKfF,EAAaC,EAAU,cANLnD,GAOlBkD,EAAaC,EAAU,WAAYF,GAKnC,IAAAlE,EAAiBoE,EClDbA,EAAW7D,EAAsC0D,YAKjDK,EAAW,yBAqDf,ICzCAtE,EDIA,SAAkBuE,GACjB,IACIC,EACAC,EAEJ,IAAML,EAAUG,GACf,MAAM,IAAInB,UAAW,uEAAyEmB,EAAM,MAGrG,GAAkB,MAAbA,EAAK,GAGT,IAAME,EADAF,EAAIG,OACI,EAAGD,GAAK,GACH,MAAbF,EAAKE,GADcA,KAO1B,YAAW,IAANA,GAAgBA,GAAK,EAClBF,EAAII,QAASL,EAAU,SAM/BE,GAHAA,EAAID,EAAIK,UAAW,EAAGH,IAGhBE,QAASL,EAAU,QAGzBC,EAAMA,EAAK,GAAMC,EAAID,EAAIK,UAAWH,KE/CrCI,GALS,ICyBT,IAAAjB,GAPA,SAAoB/C,GACnB,MAA0B,kBAAVA,GCjBbR,GCDWyE,QAAQ1E,UAAUC,SDyBjC,IEvBIoB,GAAcN,EACd4C,GFUJ,SAAelD,GACd,IAEC,OADAR,GAASK,KAAMG,IACR,EACN,MAAQW,GACT,OAAO,IEVL3B,GAPiBU,IA0CrB,IAAAyD,GAhBA,SAAoBnD,GACnB,MAAsB,iBAAVA,IACNA,aAAiBiE,UAGjBjF,GACGkE,GAAMlD,GAEoB,qBAAzBY,GAAaZ,MClCpBoD,GAAc1D,GACd2D,GAAW/C,GAkCf,ICAIgD,GAAc5D,EACdwE,GDRJ,SAAoBlE,GACnB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICSxCqD,GAAWG,GAKfF,GAAaY,GAAW,cANN9D,IAOlBkD,GAAaY,GAAW,WAAYb,IAKpC,IAAAlE,GAAiB+E,GCpCjB,IAAAC,GAPA,WACC,OAAO,IAAIC,SAAU,eAAd,ICFRC,GAL4B,iBAATC,KAAsBA,KAAO,KCKhDC,GAL8B,iBAAXC,OAAwBA,OAAS,6GCAhDvC,GAA0B,iBAAXwC,GAAwBA,GAAS,KAKpDC,OAAOC,QAAU1C,OCLbiC,GAAYxE,GAAuC0D,YACnDwB,GAAUtE,GACVuE,GAAOzE,GACP0E,GAAMtB,GACNuB,sCAkDJ,IAAAhE,GA7BA,SAAoBoD,GACnB,GAAKa,UAAUnB,OAAS,CACvB,IAAMK,GAAWC,GAChB,MAAM,IAAI5B,UAAW,+DAA+D4B,EAAQ,MAE7F,GAAKA,EACJ,OAAOS,KAKT,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,MAAM,IAAItC,MAAO,uDC3CdwC,GCOYvF,KDNZwF,GAAWD,GAAKE,UAAYF,GAAKE,SAASC,WER1CC,GAAavE,UCEbwE,GAAK5F,GACLwF,GHUaA,GGTbG,GDCaA,GC6BjB,IAAAE,GAnBA,WACC,MAEe,mBAAPD,IAGe,iBAAfD,IAGa,mBAAbH,ICST,IAAAnE,GAPA,WACC,MAAO,2BCEJyE,GAAiBlF,GADHZ,EAOL8F,GAAgB,SCjCR9F,MDsCrB,IAAAP,GAAiBqG,GEtCb5E,GAAclB,EAwClB,ICpBAP,GDWKsG,MAAMC,QACND,MAAMC,QARX,SAAkB1F,GACjB,MAAkC,mBAAzBY,GAAaZ,IEzBnB0F,GAAUhG,GC0Bd,ICGIiG,GDbJ,SAAuB3F,GACtB,OACW,OAAVA,GACiB,iBAAVA,GCQSN,EAOLiG,GAAc,oBFR3B,SAAmBC,GAClB,GAA0B,mBAAdA,EACX,MAAM,IAAIrD,UAAW,sDAAwDqD,EAAY,MAE1F,OASA,SAAgB5F,GACf,IAAI6F,EACAjC,EACJ,IAAM8B,GAAS1F,GACd,OAAO,EAGR,GAAa,KADb6F,EAAM7F,EAAM6D,QAEX,OAAO,EAER,IAAMD,EAAI,EAAGA,EAAIiC,EAAKjC,IACrB,IAAiC,IAA5BgC,EAAW5F,EAAO4D,IACtB,OAAO,EAGT,OAAO,GEpBuCkC,CAAUH,KAK1D,IAAAxG,GAAiBwG,GCvCbA,GAAejG,GA+CnB,IC3BAP,GDOA,SAAmBa,GAClB,OACC2F,GAAc3F,KAGbA,EAAM+F,WAEL/F,EAAMgG,aAGgC,mBAA/BhG,EAAMgG,YAAYC,UACzBjG,EAAMgG,YAAYC,SAAUjG,KEtC5BY,GAAclB,EACd4F,GAAKhF,GAA0C4F,OAC/CD,GAAW7F,GAuDf,IAAAW,GAxBA,SAA0BnB,GACzB,IAAIuG,EACAC,EACA/E,EAEJ,IAAe,YADf+E,EAAOxF,GAAahB,GAAIyG,MAAO,GAAI,KACC,UAATD,IAAqBxG,EAAEoG,YAAc,CAE/D,GAA0B,iBAD1B3E,EAAOzB,EAAEoG,aACQI,KAChB,OAAO/E,EAAK+E,KAGb,GADAD,EAAQb,GAAGgB,KAAMjF,EAAK7B,YAErB,OAAO2G,EAAO,GAGhB,OAAKF,GAAUrG,GACP,SAEDwG,GCnDJG,GCkBkB7G,GDmCtB,IErDI6G,GDkBkB7G,GCAtB,ICFI8G,GHkBJ,SAAiB5G,GAChB,IAAI6G,EAGJ,OAAW,OAAN7G,EACG,OAKM,YAHd6G,SAAc7G,GAIN2G,GAAU3G,GAAI8G,cAEfD,GG9BJlG,GDNJ,SAAiBX,GAChB,OAAO2G,GAAU3G,GAAI8G,eCetBvH,GAZkBO,KAOaa,GAAWiG,GCtBtCA,GAAS9G,GA2Bb,ICNAP,GDFA,SAAqBa,GAEpB,MAA6B,aAApBwG,GAAQxG,IErBdsG,GCFOK,OAAOpH,UAAU+G,KD0B5B,IEvBI1F,GAAcN,EACd4C,GFUJ,SAAelD,GACd,IAEC,OADAsG,GAAKzG,KAAMG,IACJ,EACN,MAAQW,GACT,OAAO,IEVL3B,GAPiBU,IA0CrB,IC1CIkH,GAAUlH,EACVmH,GAAavG,GACbiD,GAAWnD,EAAsCgD,YACjD0D,GDuBJ,SAAmB9G,GAClB,MAAsB,iBAAVA,IACNA,aAAiB2G,SAGjB3H,GACGkE,GAAMlD,GAEoB,oBAAzBY,GAAaZ,MC2BxB,ICvCAb,GDmBA,SAAkBuE,EAAKqD,EAAQC,GAC9B,IAAMzD,GAAUG,GACf,MAAM,IAAInB,UAAW,wEAA0EmB,EAAM,MAEtG,GAAKH,GAAUwD,GACdA,EAASH,GAASG,GAClBA,EAAS,IAAIJ,OAAQI,EAAQ,UAEzB,IAAMD,GAAUC,GACpB,MAAM,IAAIxE,UAAW,+FAAiGwE,EAAS,MAEhI,IAAMxD,GAAUyD,KAAaH,GAAYG,GACxC,MAAM,IAAIzE,UAAW,gGAAkGyE,EAAS,MAEjI,OAAOtD,EAAII,QAASiD,EAAQC,IEhC7B,IAAAjE,GAPA,SAAmB/C,GAClB,MAA0B,iBAAVA,GCAjBb,GCjBiB8H,OCAbzH,GCASE,GAMSH,UAAUC,SDkBhC,IEvBIoB,GAAcN,EACd2G,GAAS7G,GACT8C,GFSJ,SAAelD,GACd,IAEC,OADAR,GAASK,KAAMG,IACR,EACN,MAAQW,GACT,OAAO,IETL3B,GARiBU,IA2CrB,IAAAyD,GAhBA,SAAmBnD,GAClB,MAAsB,iBAAVA,IACNA,aAAiBiH,KAGjBjI,GACGkE,GAAMlD,GAEoB,oBAAzBY,GAAaZ,MCnCpBoD,GAAc1D,GACd2D,GAAW/C,GAkCf,ICOIgD,GAAc5D,EACdwH,GDfJ,SAAmBlH,GAClB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICgBxCqD,GAAWG,GAKfF,GAAa4D,GAAU,cANL9G,IAOlBkD,GAAa4D,GAAU,WAAY7D,IAKnC,IAAAlE,GAAiB+H,GCvBjB/H,GALmB8H,OAAOE,kBCS1BhI,GA1BaO,GAqBa0H,kBChCtBC,GCsBQC,KAAKD,MDIjB,IENAlI,GFDA,SAAoBoI,GACnB,OAAQF,GAAME,KAAOA,GGpBlBC,GAAO9H,GACP+H,GAAOnH,GACPoH,GAAQtH,GAuBZ,IAAAuH,GAXA,SAAoB3H,GACnB,OACCA,EAAQwH,IACRxH,EAAQyH,IACRC,GAAO1H,IClBLkH,GAAWxH,GAAsC0D,YACjDsE,GAAQpH,GA6BZ,IAAAyC,GAVA,SAAoB/C,GACnB,OACCkH,GAAUlH,IACV0H,GAAO1H,ICvBLkH,GAAWxH,GAAsC2D,SACjDqE,GAAQpH,GA6BZ,IAAA6C,GAVA,SAAoBnD,GACnB,OACCkH,GAAUlH,IACV0H,GAAO1H,EAAMgD,YCvBXI,GAAc1D,GACd2D,GAAW/C,GAkCf,ICMIgD,GAAc5D,EACdkI,GDdJ,SAAoB5H,GACnB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICexCqD,GAAWG,GAKfF,GAAasE,GAAW,cANNxH,IAOlBkD,GAAasE,GAAW,WAAYvE,IAKpC,IAAAlE,GAAiByI,GCvDbA,GAAYlI,GAAuC0D,YA6BvD,IAAAL,GAVA,SAA+B/C,GAC9B,OACC4H,GAAW5H,IACXA,GAAS,GCtBP4H,GAAYlI,GAAuC2D,SA6BvD,IAAAF,GAVA,SAA+BnD,GAC9B,OACC4H,GAAW5H,IACXA,EAAMgD,WAAa,GCtBjBI,GAAc1D,GACd2D,GAAW/C,GAsCf,ICGIgD,GAAc5D,EACdmI,GDXJ,SAA+B7H,GAC9B,OAASoD,GAAapD,IAAWqD,GAAUrD,ICYxCqD,GAAWG,GAKfF,GAAauE,GAAsB,cANjBzH,IAOlBkD,GAAauE,GAAsB,WAAYxE,IAK/C,IAAAlE,GAAiB0I,GCxDbC,GAAWxI,OAAOyI,eCatB,IAAAC,GARA,SAAmB/F,GAElB,OAAOA,EAAIO,WCPR5B,GAAclB,EACdoI,GAAWxH,GA+Bf,IAAAC,GAnBA,SAAyB0B,GACxB,IAAI+F,EAAQF,GAAU7F,GACtB,OAAK+F,GAAmB,OAAVA,EACNA,EAEgC,sBAAnCpH,GAAaqB,EAAI+D,aAEd/D,EAAI+D,YAAYzG,UAEnB0C,aAAe3C,OACZA,OAAOC,UAGR,MCzBJc,GHIayH,GGHbvH,GAAWH,GCFX0H,GDAapI,GAQAJ,OAAOyI,gBACZ1H,GAEAE,GCoBZ,ICdApB,GDFA,SAAyBa,GACxB,OACCA,QAGO,MAGRA,EAAQV,OAAQU,GAET8H,GAAU9H,KEzBd+H,GAAiBrI,GACjBkB,GAAcN,EAwClB,ICrBAnB,GDAA,SAAkBa,GACjB,GAAsB,iBAAVA,GAAgC,OAAVA,EACjC,OAAO,EAGR,GAAKA,aAAiByC,MACrB,OAAO,EAGR,KAAQzC,GAAQ,CACf,GAA8B,mBAAzBY,GAAaZ,GACjB,OAAO,EAERA,EAAQ+H,GAAgB/H,GAEzB,OAAO,GEdR,IAAAe,GAPA,WACC,MAAO,oCCWJkH,GAAW3H,GADGZ,EAOLuI,GAAU,SChCRvI,UCAX6D,GAAW7D,EAAsC0D,YACjD6E,GFyCaA,GEXjB,ICdA9I,GDAA,SAAuBuE,GACtB,IAAMH,GAAUG,GACf,MAAM,IAAInB,UAAW,uEAAyEmB,EAAM,MAMrG,OAHAA,EAAMuE,KAAW3B,KAAM5C,IAGN,IAAIiD,OAAQjD,EAAI,GAAIA,EAAI,IAAO,MEJjD,IAAA3C,GAPA,SAAgBwG,GACf,OAASA,GAAMA,GCfZL,GAAWxH,GAAsC0D,YACjD8E,GCcQxI,GDmBZ,IAAAqD,GAVA,SAAgB/C,GACf,OACCkH,GAAUlH,IACVkI,GAAOlI,IE3BLkH,GAAWxH,GAAsC2D,SACjD6E,GDcQxI,GCeZ,IAAAyD,GAVA,SAAgBnD,GACf,OACCkH,GAAUlH,IACVkI,GAAOlI,EAAMgD,YCvBXI,GAAc1D,GACd2D,GAAW/C,GAkCf,ICOIgD,GAAc5D,EACdyI,GDfJ,SAAgBnI,GACf,OAASoD,GAAapD,IAAWqD,GAAUrD,ICgBxCqD,GAAWG,GAKfF,GAAa6E,GAAO,cANF/H,IAOlBkD,GAAa6E,GAAO,WAAY9E,IAKhC,IAAAlE,GAAiBgJ,GCxDbP,GAAYlI,GAkChB,IClCIyI,GAAQzI,GACR0I,GDmBJ,SAAuBpI,GACtB,MACkB,iBAAVA,GACG,OAAVA,GACwB,iBAAjBA,EAAM6D,QACb+D,GAAW5H,EAAM6D,SACjB7D,EAAM6D,QAAU,GAChB7D,EAAM6D,QENqB,kBDnBzBN,GAAWnD,EAAsCgD,YACjDwE,GAAYpE,GAAuCJ,YA0GvD,IAAAiF,GAhDA,SAAkBlH,EAAKmH,EAAeC,GACrC,IAAI1C,EACAjC,EACJ,IAAMwE,GAAcjH,KAAUoC,GAAUpC,GACvC,MAAM,IAAIoB,UAAW,0EAA4EpB,EAAM,MAGxG,GAAa,KADb0E,EAAM1E,EAAI0C,QAET,OAAQ,EAET,GAA0B,IAArBmB,UAAUnB,OAAe,CAC7B,IAAM+D,GAAWW,GAChB,MAAM,IAAIhG,UAAW,6DAA+DgG,EAAY,MAEjG,GAAKA,GAAa,EAAI,CACrB,GAAKA,GAAa1C,EACjB,OAAQ,EAETjC,EAAI2E,OAEJ3E,EAAIiC,EAAM0C,GACD,IACR3E,EAAI,QAINA,EAAI,EAGL,GAAKuE,GAAOG,IACX,KAAQ1E,EAAIiC,EAAKjC,IAChB,GAAKuE,GAAOhH,EAAIyC,IACf,OAAOA,OAIT,KAAQA,EAAIiC,EAAKjC,IAChB,GAAKzC,EAAKyC,KAAQ0E,EACjB,OAAO1E,EAIV,OAAQ,GErDTzE,GALcO,GClBd,IAAAW,GAPA,SAAeL,GACd,OAAOV,OAAOkJ,KAAMlJ,OAAQU,KCrBzBwI,GAAO9I,GAmCX,IAAA+I,GAPA,WACC,OAlBD,WACC,OAA8C,KAArCD,GAAMxD,YAAe,IAAKnB,OAiB5BX,CAAM,EAAG,ICxBjBwF,QALoC,IAAhBpJ,OAAOkJ,KCAvB5H,GAAclB,EA+BlB,IC1BIwB,GD0BJH,GAPA,SAAsBf,GACrB,MAAkC,uBAAzBY,GAAaZ,ICzBnB2I,GAAcjJ,GA2BdkJ,GAPJ,WACC,OAAOD,GAAa3D,WAMd6D,GAKP,IC3BI3H,GD2BJ4H,GAAiB5H,GEDjB6H,GAL2BzJ,OAAOC,UAAUyJ,qBDHxCC,IAvBSvJ,GAiBGG,KAAM,OAAQ,KAW9B,IE5BI0D,GAAW7D,EACXyI,GAAQ7H,GAAmC8C,YAC3CwE,GAAYxH,GAAuCgD,YACnD8F,GAAS1F,GACT2F,GFwBajI,GE6BjB,IAAAH,GAzBA,SAA+Bf,EAAOC,GACrC,IAAIiB,EACJ,OACClB,YAKDkB,EAAOgI,GAAOrJ,KAAMG,EAAOC,KACbkJ,IAAoB5F,GAAUvD,IAIzCmI,GAFFlI,GAAYA,IAGX2H,GAAW3H,IACXA,GAAY,GACZA,EAAWD,EAAM6D,OAGZ3C,IC3BR/B,GAL2BO,GCnBvBS,GAAaT,EACb0J,GAAuB9I,GACvBoF,GAAUtF,GACVwH,GAAYpE,GCiChB,IAAArE,GAjBwBO,GACbY,GDQX,SAAsBN,GACrB,OACW,OAAVA,GACiB,iBAAVA,IACN0F,GAAS1F,IACc,iBAAjBA,EAAM6D,QACb+D,GAAW5H,EAAM6D,SACjB7D,EAAM6D,QAAU,GAChB7D,EAAM6D,QAhCSwF,YAiCflJ,GAAYH,EAAO,YAClBoJ,GAAsBpJ,EAAO,WEtC5B2I,GAAcjJ,GACdW,GAAUC,GAKV+F,GAAQZ,MAAMlG,UAAU8G,MA+B5B,IAAAiD,GAVA,SAAetJ,GACd,OAAK2I,GAAa3I,GACVK,GAASgG,GAAMxG,KAAMG,IAEtBK,GAASL,ICnBjB,ICAAuJ,GAZ2B7J,IDK3B,cCEuC,aCWvC8J,IAlB2B9J,GAKjB,CACTF,SAAY,MAO0B,YCCvC,ICJI0B,GDIJuI,GAPA,SAAiCzJ,GAChC,OAASA,EAAMgG,aAAehG,EAAMgG,YAAYzG,YAAcS,GER3D0J,GAAwB,oBAAXlF,YAA2B,EAASA,ODAjDrE,GAAaT,EACbiK,GAAUrJ,GACVkG,GAASpG,GACTwJ,GAAyBpG,GACzBqG,wPACAC,GCAaJ,GD2CbK,GAzBJ,WACC,IAAIC,EACJ,GAAuB,cAAlBxD,GAAQsD,IACZ,OAAO,EAER,IAAME,KAAKF,GACV,KAEmC,IAAjCH,GAASE,GAAeG,IACxB7J,GAAY2J,GAAKE,IACJ,OAAbF,GAAKE,IACkB,WAAvBxD,GAAQsD,GAAKE,KAEbJ,GAAwBE,GAAKE,IAE7B,MAAQrJ,GACT,OAAO,EAGT,OAAO,EAMDsJ,GAKP,IErDI/I,GAA2B,oBAAXsD,OCAhB0F,GHqDahJ,GGpDb0I,GAAyBtJ,GACzB6J,GDGajJ,GCuBjB,IC5BIyE,GAAejG,GACfS,GAAaG,EACbqI,GAAcvI,GACdgK,GAAqB5G,GACrB6G,GAAyBhB,GACzBO,GDSJ,SAAkB5J,GACjB,IAAoB,IAAfmK,KAAyBD,GAC7B,OAAON,GAAwB5J,GAEhC,IACC,OAAO4J,GAAwB5J,GAC9B,MAAQsK,GACT,OAAO,ICfLC,iHAyEJ,IC7EIlK,GAAUD,GACVoK,GAAUhH,GACVjD,GDuBJ,SAAeP,GACd,IAAIyK,EACAC,EACAC,EACAjK,EACAsJ,EACAY,EACAhH,EAGJ,GADAlD,EAAM,GACDiI,GAAa3I,GAAU,CAE3B,IAAM4D,EAAI,EAAGA,EAAI5D,EAAM6D,OAAQD,IAC9BlD,EAAImK,KAAMjH,EAAEpE,YAGb,OAAOkB,EAER,GAAsB,iBAAVV,GAEX,GAAKA,EAAM6D,OAAS,IAAM1D,GAAYH,EAAO,KAC5C,IAAM4D,EAAI,EAAGA,EAAI5D,EAAM6D,OAAQD,IAC9BlD,EAAImK,KAAMjH,EAAEpE,gBAGR,CAEN,IAAe,KADfmL,EAA2B,mBAAV3K,KACQ2F,GAAc3F,GACtC,OAAOU,EAERgK,EAAkBN,IAAsBO,EAEzC,IAAMX,KAAKhK,EACF0K,GAAuB,cAANV,IAAuB7J,GAAYH,EAAOgK,IAClEtJ,EAAImK,KAAM5H,OAAQ+G,IAGpB,GAAKK,GAEJ,IADAI,EAAkBb,GAAwB5J,GACpC4D,EAAI,EAAGA,EAAI2G,GAAe1G,OAAQD,IACvCgH,EAAIL,GAAgB3G,GACZ6G,GAAyB,gBAANG,IAAyBzK,GAAYH,EAAO4K,IACtElK,EAAImK,KAAM5H,OAAQ2H,IAIrB,OAAOlK,GEnDRvB,GDrBkBmB,GADIZ,KA6Bb8K,GAEAnK,GAGDE,GE7BRmI,QALmD,IAA/BpJ,OAAOwL,oBCAvBC,GAAgBzL,OAAOwL,oBAgC3B,IChCItC,GAAO9I,GCgCX,IAAAP,GAjBkBO,GFUlB,SAA8BM,GAC7B,OAAO+K,GAAezL,OAAQU,KCA/B,SAA8BA,GAC7B,OAAOwI,GAAMlJ,OAAQU,KEtBtB0I,QALwD,IAApCpJ,OAAO0L,yBCAvBC,GAAqB3L,OAAO0L,yBAuChC,ICvCI7K,GAAaT,ECkCjB,IAAAP,GAjBkBO,GFUlB,SAAmCM,EAAOC,GACzC,IAAIiL,EACJ,OAAKlL,cAIa,KADlBkL,EAAOD,GAAoBjL,EAAOC,IAF1B,KAG4BiL,GCLrC,SAAmClL,EAAOC,GACzC,OAAKE,GAAYH,EAAOC,GAChB,CACN2C,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ9C,MAASA,EAAOC,IAGX,iyqBEvBR,ICDIc,uJCb2BoK,ODc3B5K,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GAjB2BO,KASnBqB,GAEAR,GEjBJW,GANaxB,GACJY,GAKiB8K,MCN1BnF,GAAWvG,GACXyL,GAAS7K,GA+Bb,IAAAS,GAVA,SAAqBsK,GACpB,IAAMpF,GAAUoF,GACf,MAAM,IAAI9I,UAAW,oDAAsD8I,EAAS,KAErF,OAAOF,GAAOC,KAAMC,IC1BjBpF,GAAWvG,GACXyL,GAAS7K,GA+Bb,IAAAC,GAVA,SAAqB8K,GACpB,IAAMpF,GAAUoF,GACf,MAAM,IAAI9I,UAAW,oDAAsD8I,EAAS,KAErF,OAAO,IAAIF,GAAQE,ICOpBlM,GHtBiB+B,GGMNZ,GACIF,GCJf,ICDIC,GCb8B,mBAAdS,UAA6BA,eAAY,EDczDP,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GAjB0BO,IASlBW,GAEAE,GEvBJK,GAAclB,EAKd4L,GAAwC,mBAAfC,WA6B7B,IClCIxK,GAA+B,mBAAfwK,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuBxL,GACtB,OACGsL,IAAiBtL,aAAiBuL,YACX,wBAAzB3K,GAAaZ,IEzBXyL,GDGa1K,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArBsK,GACX,OAAO,EAGR,IAECtK,EAAM,IAAIsK,GADVtK,EAAM,CAAE,EAAG,MAAO,KAAMuK,IAAaA,MAErCxK,EACCsK,GAAcrK,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQuK,MAAbvK,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCb+B,mBAAfkL,WAA8BA,gBAAa,EDc3DhL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKdiM,GAAsD,mBAAtBC,kBA6BpC,IClCI7K,GAAsC,mBAAtB6K,kBAAqCA,kBAAoB,KCAzEC,GFwBJ,SAA8B7L,GAC7B,OACG2L,IAAwB3L,aAAiB4L,mBAClB,+BAAzBhL,GAAaZ,IE1BX8L,GDIa/K,GCuCjB,IAAAA,GA7BA,WACC,IAAIG,EACAC,EAEJ,GAAwC,mBAA5B2K,GACX,OAAO,EAGR,IACC3K,EAAM,IAAI2K,GAAyB,EAAG,EAAG,EAAG,EAAG,KAAM,KAAM,IAAK,MAChE5K,EACC2K,GAAqB1K,IACR,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,MAAbA,EAAK,IACQ,MAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbsC,mBAAtBuL,kBAAqCA,uBAAoB,EDczErL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjBkCO,KFS1BW,GAEAE,GGvBJK,GAAclB,EAKdqM,GAAwC,mBAAfC,WA6B7B,IClCIjL,GAA+B,mBAAfiL,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuBjM,GACtB,OACG+L,IAAiB/L,aAAiBgM,YACX,wBAAzBpL,GAAaZ,IExBXkM,GDEanL,GCsCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArB+K,GACX,OAAO,EAGR,IACC/K,EAAM,IAAI+K,GAAkB,CAAE,EAAG,MAAO,KAAMC,QAC9CjL,EACC+K,GAAc9K,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,QDDbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEvBR,ICDIb,GCb+B,mBAAf2L,WAA8BA,gBAAa,EDc3DzL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKd0M,GAA0C,mBAAhBC,YA6B9B,IClCItL,GAAgC,mBAAhBsL,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBtM,GACvB,OACGoM,IAAkBpM,aAAiBqM,aACZ,yBAAzBzL,GAAaZ,IEzBXuM,GDGaxL,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAkC,mBAAtBoL,GACX,OAAO,EAGR,IAECpL,EAAM,IAAIoL,GADVpL,EAAM,CAAE,EAAG,MAAO,KAAMqL,MAAcA,QAEtCtL,EACCoL,GAAenL,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQqL,QAAbrL,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbgC,mBAAhBgM,YAA+BA,iBAAc,EDc7D9L,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB4BO,KFSpBW,GAEAE,GGvBJK,GAAclB,EAKd+M,GAAwC,mBAAfC,WA6B7B,IClCI3L,GAA+B,mBAAf2L,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuB3M,GACtB,OACGyM,IAAiBzM,aAAiB0M,YACX,wBAAzB9L,GAAaZ,IExBX4M,GDEa7L,GCsCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArByL,GACX,OAAO,EAGR,IACCzL,EAAM,IAAIyL,GAAkB,CAAE,EAAG,MAAO,KAAMC,aAC9C3L,EACCyL,GAAcxL,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,aDDbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEvBR,ICDIb,GCb+B,mBAAfqM,WAA8BA,gBAAa,EDc3DnM,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKdoN,GAA0C,mBAAhBC,YA6B9B,IClCIhM,GAAgC,mBAAhBgM,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBhN,GACvB,OACG8M,IAAkB9M,aAAiB+M,aACZ,yBAAzBnM,GAAaZ,IEzBXiN,GDGalM,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAkC,mBAAtB8L,GACX,OAAO,EAGR,IAEC9L,EAAM,IAAI8L,GADV9L,EAAM,CAAE,EAAG,MAAO,KAAM+L,WAAcA,aAEtChM,EACC8L,GAAe7L,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ+L,aAAb/L,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbgC,mBAAhB0M,YAA+BA,iBAAc,EDc7DxM,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB4BO,KFSpBW,GAEAE,GGvBJK,GAAclB,EAKdyN,GAA4C,mBAAjBC,aA6B/B,IClCIrM,GAAiC,mBAAjBqM,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyBrN,GACxB,OACGmN,IAAmBnN,aAAiBoN,cACb,0BAAzBxM,GAAaZ,IE1BXwH,GAAOlH,GACPgN,GDGavM,GCqCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAmC,mBAAvBmM,GACX,OAAO,EAGR,IACCnM,EAAM,IAAImM,GAAoB,CAAE,EAAK,MAAO,KAAM,OAClDpM,EACCmM,GAAgBlM,IACH,IAAbA,EAAK,IACQ,oBAAbA,EAAK,KACS,oBAAdA,EAAK,IACLA,EAAK,KAAQqG,GAEb,MAAQ7G,GACTO,GAAO,EAER,OAAOA,GCtBR,ICDIb,GCbiC,mBAAjB+M,aAAgCA,kBAAe,EDc/D7M,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB6BO,KFSrBW,GAEAE,GGvBJK,GAAclB,EAKd6N,GAA4C,mBAAjBC,aA6B/B,IClCIzM,GAAiC,mBAAjByM,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyBzN,GACxB,OACGuN,IAAmBvN,aAAiBwN,cACb,0BAAzB5M,GAAaZ,IE1BX0N,GDIa3M,GCoCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAmC,mBAAvBuM,GACX,OAAO,EAGR,IACCvM,EAAM,IAAIuM,GAAoB,CAAE,EAAK,MAAO,KAAMC,MAClDzM,EACCuM,GAAgBtM,IACH,IAAbA,EAAK,IACQ,OAAbA,EAAK,KACS,OAAdA,EAAK,IACLA,EAAK,IAAQA,EAAK,GAElB,MAAQR,GACTO,GAAO,EAER,OAAOA,GCrBR,ICKIG,GANAhB,GCbiC,mBAAjBmN,aAAgCA,kBAAe,EDc/DjN,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCajBpB,GET4B3B,KFSrBW,GAEAE,GAMR,IG7BIO,GAAYpB,GACZ6L,GAAajL,GACbsL,GAAoBxL,GACpB4L,GAAaxI,GACb6I,GAAchD,GACdqD,GAAakB,GACbb,GAAcc,GACdT,GAAeU,GACfN,GHqBanM,GGJjB,SAAS0M,GAAW5M,GACnB,OAAO,IAAIL,GAAWK,GAUvB,SAAS6M,GAAY7M,GACpB,OAAO,IAAIoK,GAAYpK,GAUxB,SAAS8M,GAAmB9M,GAC3B,OAAO,IAAIyK,GAAmBzK,GAU/B,SAAS+M,GAAY/M,GACpB,OAAO,IAAI6K,GAAY7K,GAUxB,SAASgN,GAAahN,GACrB,OAAO,IAAIkL,GAAalL,GAUzB,SAASiN,GAAYjN,GACpB,OAAO,IAAIuL,GAAYvL,GAUxB,SAASkN,GAAalN,GACrB,OAAO,IAAI4L,GAAa5L,GAUzB,SAASmN,GAAcnN,GACtB,OAAO,IAAIiM,GAAcjM,GAU1B,SAASoN,GAAcpN,GACtB,OAAO,IAAIqM,GAAcrM,GAgC1B,IClJIhB,GAAaT,EACbgG,GAAUpF,GACV2F,GAAW7F,GACXoO,GAAUhL,GACVgD,GAAS6C,GACToF,GAASb,GACTjE,GAAUkE,GACVa,GAAaZ,GACb/C,GAAgB4D,GAChB1D,GAAqB2D,GACrB7G,GAAiB8G,GACjBvN,GAAiBwN,EACjBC,GAAaC,GACbC,GD+GO,CACTlB,UAAaA,GACbC,WAAcA,GACdC,kBAAqBA,GACrBC,WAAcA,GACdC,YAAeA,GACfC,WAAcA,GACdC,YAAeA,GACfC,aAAgBA,GAChBC,aAAgBA,ICQlB,SAASW,GAAUC,EAAKC,EAAMC,EAAOC,EAAMC,GAC1C,IAAIC,EACAhH,EACApC,EACA8E,EACA7J,EACAoO,EACAC,EACAnI,EACA3D,EACA+L,EAKJ,GAHAJ,GAAS,EAIO,iBAARJ,GACC,OAARA,EAEA,OAAOA,EAER,GAAKlJ,GAAUkJ,GACd,OAAOJ,GAAYI,GAEpB,GAAKX,GAASW,GACb,OAnFF,SAAoB7E,GACnB,IAEI9B,EACA0C,EACA0E,EACAH,EACA9O,EACAiD,EAPAyL,EAAQ,GACRC,EAAO,GA8BX,IArBA3O,EAAM,IAAI2J,EAAMtE,YAAasE,EAAMuF,SAEnCR,EAAMxE,KAAMP,GACZgF,EAAKzE,KAAMlK,GAGN2J,EAAMwF,QACVnP,EAAImP,MAAQxF,EAAMwF,OAGdxF,EAAMyF,OACVpP,EAAIoP,KAAOzF,EAAMyF,MAEbzF,EAAM0F,QACVrP,EAAIqP,MAAQ1F,EAAM0F,OAEd1F,EAAM2F,UACVtP,EAAIsP,QAAU3F,EAAM2F,SAGrBzH,EAAOkG,GAAYpE,GACb1G,EAAI,EAAGA,EAAI4E,EAAK3E,OAAQD,IAC7B6L,EAAMjH,EAAM5E,GACZsH,EAAOD,GAAoBX,EAAOmF,GAC7BtP,GAAY+K,EAAM,WACtB0E,EAAQlK,GAAS4E,EAAOmF,IAAY,GAAK,GACzCvE,EAAKlL,MAAQkP,GAAU5E,EAAOmF,GAAOG,EAAKP,EAAOC,GAAO,IAEzDhO,GAAgBX,EAAK8O,EAAKvE,GAE3B,OAAOvK,EA0CCuP,CAAWf,GAKnB,GAAc,UAFd/I,EAAOI,GAAQ2I,IAGd,OAAO,IAAIgB,MAAOhB,GAEnB,GAAc,WAAT/I,EACJ,OAAOqI,GAAQU,EAAI3P,YAEpB,GAAc,QAAT4G,EACJ,OAAO,IAAIgK,IAAKjB,GAEjB,GAAc,QAAT/I,EACJ,OAAO,IAAIiK,IAAKlB,GAEjB,GACU,WAAT/I,GACS,YAATA,GACS,WAATA,EAGA,OAAO+I,EAAInM,UAGZ,GADA3B,EAAO4N,GAAa7I,GAEnB,OAAO/E,EAAM8N,GAGd,GACU,UAAT/I,GACS,WAATA,EAGA,MAA8B,mBAAlB9G,OAAOgR,OA1KrB,SAAwBnB,GACvB,IAAIE,EACAkB,EACAnK,EACAkJ,EACApE,EACA0E,EACAF,EACA9L,EAUJ,IARAyL,EAAQ,GACRC,EAAO,GAEPI,EAAMpQ,OAAOkR,OAAQzI,GAAgBoH,IACrCE,EAAMxE,KAAMsE,GACZG,EAAKzE,KAAM6E,GAEXa,EAAQxF,GAAeoE,GACjBvL,EAAI,EAAGA,EAAI2M,EAAM1M,OAAQD,IAC9BwC,EAAOmK,EAAO3M,GACdsH,EAAOD,GAAoBkE,EAAK/I,GAC3BjG,GAAY+K,EAAM,WACtB0E,EAAQlK,GAASyJ,EAAI/I,IAAY,GAAK,GACtC8E,EAAKlL,MAAQkP,GAAUC,EAAI/I,GAAOwJ,EAAKP,EAAOC,GAAO,IAEtDhO,GAAgBoO,EAAKtJ,EAAM8E,GAW5B,OATM5L,OAAOmR,aAActB,IAC1B7P,OAAOoR,kBAAmBhB,GAEtBpQ,OAAOqR,SAAUxB,IACrB7P,OAAOsR,KAAMlB,GAETpQ,OAAOuR,SAAU1B,IACrB7P,OAAOgR,OAAQZ,GAETA,EAuIEoB,CAAe3B,GAEhB,GAIR,GADA3G,EAAOkG,GAAYS,GACdI,EAAQ,EAEZ,IADAC,EAASpJ,EACHuJ,EAAI,EAAGA,EAAInH,EAAK3E,OAAQ8L,IAE7BpI,EAAI4H,EADJM,EAAMjH,EAAMmH,IAIZvJ,EAAOI,GAAQe,GAED,iBAANA,GACD,OAANA,GAEU,UAATnB,GACS,WAATA,GAEDH,GAAUsB,GAEM,WAAXiI,GACJtE,EAAOD,GAAoBkE,EAAKM,GAC3BtP,GAAY+K,EAAM,WACtBA,EAAKlL,MAAQkP,GAAU3H,IAExBjG,GAAgB8N,EAAMK,EAAKvE,IAE3BkE,EAAMK,GAAQP,GAAU3H,IAMd,KADZ3D,EAAI+F,GAAS0F,EAAO9H,KAMpBmI,EAAQhK,GAAS6B,GAAQ,IAAI9B,MAAO8B,EAAE1D,QAAW,GACjDwL,EAAMxE,KAAMtD,GACZ+H,EAAKzE,KAAM6E,GACK,UAAXF,EACJJ,EAAMK,GAAQP,GAAU3H,EAAGmI,EAAKL,EAAOC,EAAMC,IAE7CrE,EAAOD,GAAoBkE,EAAKM,GAC3BtP,GAAY+K,EAAM,WACtBA,EAAKlL,MAAQkP,GAAU3H,EAAGmI,EAAKL,EAAOC,EAAMC,IAE7CjO,GAAgB8N,EAAMK,EAAKvE,KAd3BkE,EAAMK,GAAQH,EAAM1L,QAiBhB,GAAc,UAATwC,EACX,IAAMuJ,EAAI,EAAGA,EAAInH,EAAK3E,OAAQ8L,IAE7BP,EADAK,EAAMjH,EAAMmH,IACER,EAAKM,QAGpB,IAAME,EAAI,EAAGA,EAAInH,EAAK3E,OAAQ8L,IAC7BF,EAAMjH,EAAMmH,GACZzE,EAAOD,GAAoBkE,EAAKM,GAChCnO,GAAgB8N,EAAMK,EAAKvE,GAY7B,OATM5L,OAAOmR,aAActB,IAC1B7P,OAAOoR,kBAAmBtB,GAEtB9P,OAAOqR,SAAUxB,IACrB7P,OAAOsR,KAAMxB,GAET9P,OAAOuR,SAAU1B,IACrB7P,OAAOgR,OAAQlB,GAETA,EAMR,IC3RI1J,GAAUhG,GACVmI,GAAuBvH,GAAmD8C,YAC1EoE,GAAOpH,GACP8O,GDwRaA,GCtOjB,IAAA6B,GAnBA,SAAe/Q,EAAOuP,GACrB,IAAI7O,EACJ,GAAKsE,UAAUnB,OAAS,EAAI,CAC3B,IAAMgE,GAAsB0H,GAC3B,MAAM,IAAIhN,UAAW,oEAAsEgN,EAAQ,MAEpG,GAAe,IAAVA,EACJ,OAAOvP,OAGRuP,EAAQ/H,GAGT,OADA9G,EAAQgF,GAAS1F,GAAY,IAAIyF,MAAOzF,EAAM6D,QAAW,GAClDqL,GAAUlP,EAAOU,EAAK,CAACV,GAAQ,CAACU,GAAM6O,ICd9CpQ,GALWO,GC5BPgG,GAAUhG,GA8Bd,IC9BI2D,GDmBJ,SAAmBrD,GAClB,MACkB,iBAAVA,GACG,OAAVA,IACC0F,GAAS1F,ICtBR6G,GAAavG,GACbyH,GAAiB3H,GACjBD,GAAaqD,EACb5C,GAAcyI,EAKd2H,GAAkB1R,OAAOC,UAgF7B,IAAAwB,GAvCA,SAAwBf,GACvB,IAAIgI,EAGJ,QAAM3E,GAAUrD,OAIhBgI,EAAQD,GAAgB/H,MAOtBG,GAAYH,EAAO,gBAGpBG,GAAY6H,EAAO,gBACnBnB,GAAYmB,EAAMhC,cACmB,sBAArCpF,GAAaoH,EAAMhC,cAGnB7F,GAAY6H,EAAO,kBACnBnB,GAAYmB,EAAMiJ,iBAIjBjJ,IAAUgJ,IAzDb,SAAmB/O,GAClB,IAAIwN,EAGJ,IAAMA,KAAOxN,EACZ,IAAM9B,GAAY8B,EAAKwN,GACtB,OAAO,EAGT,OAAO,EAmDLyB,CAAUlR,MCjFTqD,GCegB3D,GDdhBS,GAAaG,EACbiD,GAAWnD,EAAsCgD,YAqCrD,wJEvCIU,GAAUpE,GACV0P,GAAO9O,GACP6Q,GFeJ,SAAmBC,EAAMC,GACxB,OAAMhO,GAAUgO,GAGXlR,GAAYkR,EAAS,SACzBD,EAAKE,IAAMD,EAAQC,KACb/N,GAAU6N,EAAKE,MACb,IAAI/O,UAAW,qEAAuE6O,EAAKE,IAAM,MAGrGnR,GAAYkR,EAAS,aACzBD,EAAKvB,QAAUwB,EAAQxB,SACjBtM,GAAU6N,EAAKvB,UACb,IAAItN,UAAW,yEAA2E6O,EAAKvB,QAAU,MAG3G,KAdC,IAAItN,UAAW,iEAAmE8O,EAAU,OEhBjGE,GAAW/N,GAwDf,IAAAgO,GAnCA,SAAkBH,GACjB,IAAID,EACAzQ,EAGJ,GAFAyQ,EAAOhC,GAAMmC,IACb5Q,EAAMwQ,GAAUC,EAAMC,GAErB,MAAM1Q,EAEP,OAUA,WACC,IAEI8Q,EACA7N,EAHAmM,EAAO/K,UAAW,GAClBsM,EAAMF,EAAKE,IAAM,SAASvB,EAG9B,IAAMnM,EAAI,EAAGA,EAAIoB,UAAUnB,OAAQD,IAClC0N,GAAO,UAAYI,mBAAoB1M,UAAWpB,IAInD,OAFA6N,EAAM3N,GAASsN,EAAKvB,QAAS,UAAWyB,GACxCG,EAAM3N,GAAS2N,EAAK,WAAY1B,KCtC9B4B,GCbUjS,GACCY,IDWGZ,EAOLiS,GAAwB,UALvBvR,IAUd,IAAAjB,GAAiBwS,UEJZC,IACGvR,ECZR,WACC,MAAM,IAAIoC,MAAOoP,GAAQ"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index a2f1cbe..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=r()}(this,(function(){"use strict";function t(t){var r=t.default;if("function"==typeof r){var n=function(){return r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var e=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,e.get?e:{enumerable:!0,get:function(){return t[r]}})})),n}var r=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();var n=function(){return r&&"symbol"==typeof Symbol.toStringTag},e=Object.prototype.toString,o=e;var i=function(t){return o.call(t)},u=Object.prototype.hasOwnProperty;var f=function(t,r){return null!=t&&u.call(t,r)},a="function"==typeof Symbol?Symbol.toStringTag:"",c=f,s=a,l=e;var h=i,p=function(t){var r,n,e;if(null==t)return l.call(t);n=t[s],r=c(t,s);try{t[s]=void 0}catch(r){return l.call(t)}return e=l.call(t),r?t[s]=n:delete t[s],e},y=n()?p:h,v=y,g="function"==typeof Int8Array;var w="function"==typeof Int8Array?Int8Array:null,d=function(t){return g&&t instanceof Int8Array||"[object Int8Array]"===v(t)},b=w;var m=function(){var t,r;if("function"!=typeof b)return!1;try{r=new b([1,3.14,-3.14,128]),t=d(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t},A=m,E="function"==typeof Int8Array?Int8Array:void 0,_="function"==typeof Object.defineProperty?Object.defineProperty:null;var O=function(){try{return _({},"x",{}),!0}catch(t){return!1}},P=Object.defineProperty,j=Object.prototype,R=j.toString,T=j.__defineGetter__,U=j.__defineSetter__,I=j.__lookupGetter__,S=j.__lookupSetter__;var B=function(t,r,n){var e,o,i,u;if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof n||null===n||"[object Array]"===R.call(n))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+n+"`.");if((o="value"in n)&&(I.call(t,r)||S.call(t,r)?(e=t.__proto__,t.__proto__=j,delete t[r],t[r]=n.value,t.__proto__=e):t[r]=n.value),i="get"in n,u="set"in n,o&&(i||u))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return i&&T&&T.call(t,r,n.get),u&&U&&U.call(t,r,n.set),t},Y=P,x=B,C=O()?Y:x,M=C;var L=function(t,r,n){M(t,r,{configurable:!1,enumerable:!1,writable:!1,value:n})},F=L;var D=function(t){return"string"==typeof t},N=String.prototype.valueOf;var k=y,V=function(t){try{return N.call(t),!0}catch(t){return!1}},z=n();var G=function(t){return"object"==typeof t&&(t instanceof String||(z?V(t):"[object String]"===k(t)))},X=D,$=G;var H=F,W=function(t){return X(t)||$(t)},q=G;H(W,"isPrimitive",D),H(W,"isObject",q);var J=W,Z=J.isPrimitive,K=/[-\/\\^$*+?.()|[\]{}]/g;var Q=function(t){var r,n;if(!Z(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");if("/"===t[0])for(n=t.length-1;n>=0&&"/"!==t[n];n--);return void 0===n||n<=0?t.replace(K,"\\$&"):(r=(r=t.substring(1,n)).replace(K,"\\$&"),t=t[0]+r+t.substring(n))},tt=/./;var rt=function(t){return"boolean"==typeof t},nt=Boolean.prototype.toString;var et=y,ot=function(t){try{return nt.call(t),!0}catch(t){return!1}},it=n();var ut=function(t){return"object"==typeof t&&(t instanceof Boolean||(it?ot(t):"[object Boolean]"===et(t)))},ft=rt,at=ut;var ct=F,st=function(t){return ft(t)||at(t)},lt=ut;ct(st,"isPrimitive",rt),ct(st,"isObject",lt);var ht=st;var pt=function(){return new Function("return this;")()},yt="object"==typeof self?self:null,vt="object"==typeof window?window:null,gt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},wt="object"==typeof gt?gt:null;module.exports=wt;var dt=ht.isPrimitive,bt=pt,mt=yt,At=vt,Et=t(Object.freeze({__proto__:null}));var _t=function(t){if(arguments.length){if(!dt(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return bt()}if(mt)return mt;if(At)return At;if(Et)return Et;throw new Error("unexpected error. Unable to resolve global object.")},Ot=_t(),Pt=Ot.document&&Ot.document.childNodes,jt=Int8Array,Rt=tt,Tt=Pt,Ut=jt;var It=function(){return"function"==typeof Rt||"object"==typeof Ut||"function"==typeof Tt};var St=function(){return/^\s*function\s*([^(]*)/i},Bt=St;F(Bt,"REGEXP",St());var Yt=Bt,xt=y;var Ct=Array.isArray?Array.isArray:function(t){return"[object Array]"===xt(t)},Mt=Ct;var Lt=function(t){return null!==t&&"object"==typeof t};F(Lt,"isObjectLikeArray",function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(r){var n,e;if(!Mt(r))return!1;if(0===(n=r.length))return!1;for(e=0;ejr&&Rr(t)},Ur=mr.isPrimitive,Ir=Tr;var Sr=function(t){return Ur(t)&&Ir(t)},Br=mr.isObject,Yr=Tr;var xr=function(t){return Br(t)&&Yr(t.valueOf())},Cr=Sr,Mr=xr;var Lr=F,Fr=function(t){return Cr(t)||Mr(t)},Dr=xr;Lr(Fr,"isPrimitive",Sr),Lr(Fr,"isObject",Dr);var Nr=Fr,kr=Nr.isPrimitive;var Vr=function(t){return kr(t)&&t>=0},zr=Nr.isObject;var Gr=function(t){return zr(t)&&t.valueOf()>=0},Xr=Vr,$r=Gr;var Hr=F,Wr=function(t){return Xr(t)||$r(t)},qr=Gr;Hr(Wr,"isPrimitive",Vr),Hr(Wr,"isObject",qr);var Jr=Wr,Zr=Object.getPrototypeOf;var Kr=function(t){return t.__proto__},Qr=y,tn=Kr;var rn=function(t){var r=tn(t);return r||null===r?r:"[object Function]"===Qr(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null},nn=Zr,en=rn,on=Zt(Object.getPrototypeOf)?nn:en;var un=function(t){return null==t?null:(t=Object(t),on(t))},fn=un,an=y;var cn=function(t){if("object"!=typeof t||null===t)return!1;if(t instanceof Error)return!0;for(;t;){if("[object Error]"===an(t))return!0;t=fn(t)}return!1};var sn=function(){return/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/},ln=sn;F(ln,"REGEXP",sn());var hn=J.isPrimitive,pn=ln;var yn=function(t){if(!hn(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");return(t=pn().exec(t))?new RegExp(t[1],t[2]):null};var vn=function(t){return t!=t},gn=mr.isPrimitive,wn=vn;var dn=function(t){return gn(t)&&wn(t)},bn=mr.isObject,mn=vn;var An=function(t){return bn(t)&&mn(t.valueOf())},En=dn,_n=An;var On=F,Pn=function(t){return En(t)||_n(t)},jn=An;On(Pn,"isPrimitive",dn),On(Pn,"isObject",jn);var Rn=Pn,Tn=Or;var Un=Rn,In=function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Tn(t.length)&&t.length>=0&&t.length<=9007199254740991},Sn=J.isPrimitive,Bn=Nr.isPrimitive;var Yn=function(t,r,n){var e,o;if(!In(t)&&!Sn(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(e=t.length))return-1;if(3===arguments.length){if(!Bn(n))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+n+"`.");if(n>=0){if(n>=e)return-1;o=n}else(o=e+n)<0&&(o=0)}else o=0;if(Un(r)){for(;o=0&&r=0&&t.length<=4294967295&&Qn(t,"callee")&&!te(t,"callee")},oe=ee,ie=Cn,ue=Array.prototype.slice;var fe=function(t){return oe(t)?ie(ue.call(t)):ie(t)};var ae=Kn((function(){}),"prototype"),ce=!Kn({toString:null},"toString");var se,le=function(t){return t.constructor&&t.constructor.prototype===t},he="undefined"==typeof window?void 0:window,pe=f,ye=xn,ve=qt,ge=le,we=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],de=he;se=function(){var t;if("undefined"===ve(de))return!1;for(t in de)try{-1===ye(we,t)&&pe(de,t)&&null!==de[t]&&"object"===ve(de[t])&&ge(de[t])}catch(t){return!0}return!1}();var be="undefined"!=typeof window,me=se,Ae=le,Ee=be;var _e=Ft,Oe=f,Pe=ee,je=ae,Re=ce,Te=function(t){if(!1===Ee&&!me)return Ae(t);try{return Ae(t)}catch(t){return!1}},Ue=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var Ie=Cn,Se=fe,Be=function(t){var r,n,e,o,i,u,f;if(o=[],Pe(t)){for(f=0;f0&&!Oe(t,"0"))for(f=0;f>18&63]+Ve[o>>12&63]+Ve[o>>6&63]+Ve[63&o]);return i.join("")}function We(t){var r;Xe||$e();for(var n=t.length,e=n%3,o="",i=[],u=16383,f=0,a=n-e;fa?a:f+u));return 1===e?(r=t[n-1],o+=Ve[r>>2],o+=Ve[r<<4&63],o+="=="):2===e&&(r=(t[n-2]<<8)+t[n-1],o+=Ve[r>>10],o+=Ve[r>>4&63],o+=Ve[r<<2&63],o+="="),i.push(o),i.join("")}function qe(t,r,n,e,o){var i,u,f=8*o-e-1,a=(1<>1,s=-7,l=n?o-1:0,h=n?-1:1,p=t[r+l];for(l+=h,i=p&(1<<-s)-1,p>>=-s,s+=f;s>0;i=256*i+t[r+l],l+=h,s-=8);for(u=i&(1<<-s)-1,i>>=-s,s+=e;s>0;u=256*u+t[r+l],l+=h,s-=8);if(0===i)i=1-c;else{if(i===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,e),i-=c}return(p?-1:1)*u*Math.pow(2,i-e)}function Je(t,r,n,e,o,i){var u,f,a,c=8*i-o-1,s=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=e?0:i-1,y=e?1:-1,v=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-u))<1&&(u--,a*=2),(r+=u+l>=1?h/a:h*Math.pow(2,1-l))*a>=2&&(u++,a/=2),u+l>=s?(f=0,u=s):u+l>=1?(f=(r*a-1)*Math.pow(2,o),u+=l):(f=r*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[n+p]=255&f,p+=y,f/=256,o-=8);for(u=u<0;t[n+p]=255&u,p+=y,u/=256,c-=8);t[n+p-y]|=128*v}var Ze={}.toString,Ke=Array.isArray||function(t){return"[object Array]"==Ze.call(t)};no.TYPED_ARRAY_SUPPORT=void 0===gt.TYPED_ARRAY_SUPPORT||gt.TYPED_ARRAY_SUPPORT;var Qe=to();function to(){return no.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ro(t,r){if(to()=to())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+to().toString(16)+" bytes");return 0|t}function ao(t){return!(null==t||!t._isBuffer)}function co(t,r){if(ao(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Lo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Fo(t).length;default:if(e)return Lo(t).length;r=(""+r).toLowerCase(),e=!0}}function so(t,r,n){var e=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return jo(this,r,n);case"utf8":case"utf-8":return Eo(this,r,n);case"ascii":return Oo(this,r,n);case"latin1":case"binary":return Po(this,r,n);case"base64":return Ao(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ro(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),e=!0}}function lo(t,r,n){var e=t[r];t[r]=t[n],t[n]=e}function ho(t,r,n,e,o){if(0===t.length)return-1;if("string"==typeof n?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=no.from(r,e)),ao(r))return 0===r.length?-1:po(t,r,n,e,o);if("number"==typeof r)return r&=255,no.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):po(t,[r],n,e,o);throw new TypeError("val must be string, number or Buffer")}function po(t,r,n,e,o){var i,u=1,f=t.length,a=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(t.length<2||r.length<2)return-1;u=2,f/=2,a/=2,n/=2}function c(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var s=-1;for(i=n;if&&(n=f-a),i=n;i>=0;i--){for(var l=!0,h=0;ho&&(e=o):e=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");e>i/2&&(e=i/2);for(var u=0;u>8,o=n%256,i.push(o),i.push(e);return i}(r,t.length-n),t,n,e)}function Ao(t,r,n){return 0===r&&n===t.length?We(t):We(t.slice(r,n))}function Eo(t,r,n){n=Math.min(t.length,n);for(var e=[],o=r;o239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(s=c);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&c)<<6|63&i)>127&&(s=a);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(a=(15&c)<<12|(63&i)<<6|63&u)>2047&&(a<55296||a>57343)&&(s=a);break;case 4:i=t[o+1],u=t[o+2],f=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&f)&&(a=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&f)>65535&&a<1114112&&(s=a)}null===s?(s=65533,l=1):s>65535&&(s-=65536,e.push(s>>>10&1023|55296),s=56320|1023&s),e.push(s),o+=l}return function(t){var r=t.length;if(r<=_o)return String.fromCharCode.apply(String,t);var n="",e=0;for(;e0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},no.prototype.compare=function(t,r,n,e,o){if(!ao(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===e&&(e=0),void 0===o&&(o=this.length),r<0||n>t.length||e<0||o>this.length)throw new RangeError("out of range index");if(e>=o&&r>=n)return 0;if(e>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(e>>>=0),u=(n>>>=0)-(r>>>=0),f=Math.min(i,u),a=this.slice(e,o),c=t.slice(r,n),s=0;so)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var i=!1;;)switch(e){case"hex":return yo(this,t,r,n);case"utf8":case"utf-8":return vo(this,t,r,n);case"ascii":return go(this,t,r,n);case"latin1":case"binary":return wo(this,t,r,n);case"base64":return bo(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mo(this,t,r,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),i=!0}},no.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _o=4096;function Oo(t,r,n){var e="";n=Math.min(t.length,n);for(var o=r;oe)&&(n=e);for(var o="",i=r;in)throw new RangeError("Trying to access beyond buffer length")}function Uo(t,r,n,e,o,i){if(!ao(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function Io(t,r,n,e){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-n,2);o>>8*(e?o:1-o)}function So(t,r,n,e){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-n,4);o>>8*(e?o:3-o)&255}function Bo(t,r,n,e,o,i){if(n+e>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Yo(t,r,n,e,o){return o||Bo(t,0,n,4),Je(t,r,n,e,23,4),n+4}function xo(t,r,n,e,o){return o||Bo(t,0,n,8),Je(t,r,n,e,52,8),n+8}no.prototype.slice=function(t,r){var n,e=this.length;if((t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r0&&(o*=256);)e+=this[t+--r]*o;return e},no.prototype.readUInt8=function(t,r){return r||To(t,1,this.length),this[t]},no.prototype.readUInt16LE=function(t,r){return r||To(t,2,this.length),this[t]|this[t+1]<<8},no.prototype.readUInt16BE=function(t,r){return r||To(t,2,this.length),this[t]<<8|this[t+1]},no.prototype.readUInt32LE=function(t,r){return r||To(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},no.prototype.readUInt32BE=function(t,r){return r||To(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},no.prototype.readIntLE=function(t,r,n){t|=0,r|=0,n||To(t,r,this.length);for(var e=this[t],o=1,i=0;++i=(o*=128)&&(e-=Math.pow(2,8*r)),e},no.prototype.readIntBE=function(t,r,n){t|=0,r|=0,n||To(t,r,this.length);for(var e=r,o=1,i=this[t+--e];e>0&&(o*=256);)i+=this[t+--e]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},no.prototype.readInt8=function(t,r){return r||To(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},no.prototype.readInt16LE=function(t,r){r||To(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},no.prototype.readInt16BE=function(t,r){r||To(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},no.prototype.readInt32LE=function(t,r){return r||To(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},no.prototype.readInt32BE=function(t,r){return r||To(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},no.prototype.readFloatLE=function(t,r){return r||To(t,4,this.length),qe(this,t,!0,23,4)},no.prototype.readFloatBE=function(t,r){return r||To(t,4,this.length),qe(this,t,!1,23,4)},no.prototype.readDoubleLE=function(t,r){return r||To(t,8,this.length),qe(this,t,!0,52,8)},no.prototype.readDoubleBE=function(t,r){return r||To(t,8,this.length),qe(this,t,!1,52,8)},no.prototype.writeUIntLE=function(t,r,n,e){(t=+t,r|=0,n|=0,e)||Uo(this,t,r,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+n},no.prototype.writeUInt8=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,1,255,0),no.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},no.prototype.writeUInt16LE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,2,65535,0),no.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Io(this,t,r,!0),r+2},no.prototype.writeUInt16BE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,2,65535,0),no.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Io(this,t,r,!1),r+2},no.prototype.writeUInt32LE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,4,4294967295,0),no.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):So(this,t,r,!0),r+4},no.prototype.writeUInt32BE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,4,4294967295,0),no.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):So(this,t,r,!1),r+4},no.prototype.writeIntLE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);Uo(this,t,r,n,o-1,-o)}var i=0,u=1,f=0;for(this[r]=255&t;++i>0)-f&255;return r+n},no.prototype.writeIntBE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);Uo(this,t,r,n,o-1,-o)}var i=n-1,u=1,f=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===f&&0!==this[r+i+1]&&(f=1),this[r+i]=(t/u>>0)-f&255;return r+n},no.prototype.writeInt8=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,1,127,-128),no.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},no.prototype.writeInt16LE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,2,32767,-32768),no.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Io(this,t,r,!0),r+2},no.prototype.writeInt16BE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,2,32767,-32768),no.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Io(this,t,r,!1),r+2},no.prototype.writeInt32LE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,4,2147483647,-2147483648),no.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):So(this,t,r,!0),r+4},no.prototype.writeInt32BE=function(t,r,n){return t=+t,r|=0,n||Uo(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),no.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):So(this,t,r,!1),r+4},no.prototype.writeFloatLE=function(t,r,n){return Yo(this,t,r,!0,n)},no.prototype.writeFloatBE=function(t,r,n){return Yo(this,t,r,!1,n)},no.prototype.writeDoubleLE=function(t,r,n){return xo(this,t,r,!0,n)},no.prototype.writeDoubleBE=function(t,r,n){return xo(this,t,r,!1,n)},no.prototype.copy=function(t,r,n,e){if(n||(n=0),e||0===e||(e=this.length),r>=t.length&&(r=t.length),r||(r=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(i<1e3||!no.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&n<57344){if(!o){if(n>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===e){(r-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(r-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((r-=1)<0)break;i.push(n)}else if(n<2048){if((r-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((r-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Fo(t){return function(t){var r,n,e,o,i,u;Xe||$e();var f=t.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[f-2]?2:"="===t[f-1]?1:0,u=new Ge(3*f/4-i),e=i>0?f-4:f;var a=0;for(r=0,n=0;r>16&255,u[a++]=o>>8&255,u[a++]=255&o;return 2===i?(o=ze[t.charCodeAt(r)]<<2|ze[t.charCodeAt(r+1)]>>4,u[a++]=255&o):1===i&&(o=ze[t.charCodeAt(r)]<<10|ze[t.charCodeAt(r+1)]<<4|ze[t.charCodeAt(r+2)]>>2,u[a++]=o>>8&255,u[a++]=255&o),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Co,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Do(t,r,n,e){for(var o=0;o=r.length||o>=t.length);++o)r[o+n]=t[o];return o}function No(t){return null!=t&&(!!t._isBuffer||ko(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ko(t.slice(0,0))}(t))}function ko(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Vo=Object.freeze({__proto__:null,Buffer:no,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),no.alloc(+t)},isBuffer:No,kMaxLength:Qe}),zo=no;module.exports=zo;var Go=Nt,Xo=t(Object.freeze({__proto__:null}));var $o=function(){var t,r;if("function"!=typeof Xo)return!1;try{r="function"==typeof Xo.from?Xo.from([1,2,3,4]):new Xo([1,2,3,4]),t=Go(r)&&1===r[0]&&2===r[1]&&3===r[2]&&4===r[3]}catch(r){t=!1}return t},Ho=$o;var Wo=t(Vo).Buffer,qo=function(){throw new Error("not implemented")},Jo=Ho()?Wo:qo,Zo=Zt(Jo.from),Ko=Nt,Qo=Jo;var ti=function(t){if(!Ko(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return Qo.from(t)},ri=Nt,ni=Jo;var ei=function(t){if(!ri(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return new ni(t)},oi=Zo?ti:ei;var ii="function"==typeof Int8Array?Int8Array:void 0,ui=function(){throw new Error("not implemented")},fi=A()?ii:ui,ai=y,ci="function"==typeof Uint8Array;var si="function"==typeof Uint8Array?Uint8Array:null,li=function(t){return ci&&t instanceof Uint8Array||"[object Uint8Array]"===ai(t)},hi=si;var pi=function(){var t,r;if("function"!=typeof hi)return!1;try{r=new hi(r=[1,3.14,-3.14,256,257]),t=li(r)&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var yi="function"==typeof Uint8Array?Uint8Array:void 0,vi=function(){throw new Error("not implemented")},gi=pi()?yi:vi,wi=y,di="function"==typeof Uint8ClampedArray;var bi="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null,mi=function(t){return di&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===wi(t)},Ai=bi;var Ei=function(){var t,r;if("function"!=typeof Ai)return!1;try{r=new Ai([-1,0,1,3.14,4.99,255,256]),t=mi(r)&&0===r[0]&&0===r[1]&&1===r[2]&&3===r[3]&&5===r[4]&&255===r[5]&&255===r[6]}catch(r){t=!1}return t};var _i="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,Oi=function(){throw new Error("not implemented")},Pi=Ei()?_i:Oi,ji=y,Ri="function"==typeof Int16Array;var Ti="function"==typeof Int16Array?Int16Array:null,Ui=function(t){return Ri&&t instanceof Int16Array||"[object Int16Array]"===ji(t)},Ii=Ti;var Si=function(){var t,r;if("function"!=typeof Ii)return!1;try{r=new Ii([1,3.14,-3.14,32768]),t=Ui(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t};var Bi="function"==typeof Int16Array?Int16Array:void 0,Yi=function(){throw new Error("not implemented")},xi=Si()?Bi:Yi,Ci=y,Mi="function"==typeof Uint16Array;var Li="function"==typeof Uint16Array?Uint16Array:null,Fi=function(t){return Mi&&t instanceof Uint16Array||"[object Uint16Array]"===Ci(t)},Di=Li;var Ni=function(){var t,r;if("function"!=typeof Di)return!1;try{r=new Di(r=[1,3.14,-3.14,65536,65537]),t=Fi(r)&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var ki="function"==typeof Uint16Array?Uint16Array:void 0,Vi=function(){throw new Error("not implemented")},zi=Ni()?ki:Vi,Gi=y,Xi="function"==typeof Int32Array;var $i="function"==typeof Int32Array?Int32Array:null,Hi=function(t){return Xi&&t instanceof Int32Array||"[object Int32Array]"===Gi(t)},Wi=$i;var qi=function(){var t,r;if("function"!=typeof Wi)return!1;try{r=new Wi([1,3.14,-3.14,2147483648]),t=Hi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t};var Ji="function"==typeof Int32Array?Int32Array:void 0,Zi=function(){throw new Error("not implemented")},Ki=qi()?Ji:Zi,Qi=y,tu="function"==typeof Uint32Array;var ru="function"==typeof Uint32Array?Uint32Array:null,nu=function(t){return tu&&t instanceof Uint32Array||"[object Uint32Array]"===Qi(t)},eu=ru;var ou=function(){var t,r;if("function"!=typeof eu)return!1;try{r=new eu(r=[1,3.14,-3.14,4294967296,4294967297]),t=nu(r)&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var iu="function"==typeof Uint32Array?Uint32Array:void 0,uu=function(){throw new Error("not implemented")},fu=ou()?iu:uu,au=y,cu="function"==typeof Float32Array;var su="function"==typeof Float32Array?Float32Array:null,lu=function(t){return cu&&t instanceof Float32Array||"[object Float32Array]"===au(t)},hu=Ar,pu=su;var yu=function(){var t,r;if("function"!=typeof pu)return!1;try{r=new pu([1,3.14,-3.14,5e40]),t=lu(r)&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===hu}catch(r){t=!1}return t};var vu="function"==typeof Float32Array?Float32Array:void 0,gu=function(){throw new Error("not implemented")},wu=yu()?vu:gu,du=y,bu="function"==typeof Float64Array;var mu="function"==typeof Float64Array?Float64Array:null,Au=function(t){return bu&&t instanceof Float64Array||"[object Float64Array]"===du(t)},Eu=mu;var _u=function(){var t,r;if("function"!=typeof Eu)return!1;try{r=new Eu([1,3.14,-3.14,NaN]),t=Au(r)&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t};var Ou,Pu="function"==typeof Float64Array?Float64Array:void 0,ju=function(){throw new Error("not implemented")};Ou=_u()?Pu:ju;var Ru=fi,Tu=gi,Uu=Pi,Iu=xi,Su=zi,Bu=Ki,Yu=fu,xu=wu,Cu=Ou;function Mu(t){return new Ru(t)}function Lu(t){return new Tu(t)}function Fu(t){return new Uu(t)}function Du(t){return new Iu(t)}function Nu(t){return new Su(t)}function ku(t){return new Bu(t)}function Vu(t){return new Yu(t)}function zu(t){return new xu(t)}function Gu(t){return new Cu(t)}var Xu=f,$u=Ct,Hu=Nt,Wu=cn,qu=qt,Ju=yn,Zu=xn,Ku=Ye,Qu=Le,tf=ke,rf=un,nf=C,ef=oi,of={int8array:Mu,uint8array:Lu,uint8clampedarray:Fu,int16array:Du,uint16array:Nu,int32array:ku,uint32array:Vu,float32array:zu,float64array:Gu};function uf(t,r,n,e,o){var i,u,f,a,c,s,l,h,p,y;if(o-=1,"object"!=typeof t||null===t)return t;if(Hu(t))return ef(t);if(Wu(t))return function(t){var r,n,e,o,i,u,f=[],a=[];for(i=new t.constructor(t.message),f.push(t),a.push(i),t.stack&&(i.stack=t.stack),t.code&&(i.code=t.code),t.errno&&(i.errno=t.errno),t.syscall&&(i.syscall=t.syscall),r=Ku(t),u=0;u0)for(i=f,y=0;y1){if(!af(r))throw new TypeError("invalid argument. `level` must be a nonnegative integer. Value: `"+r+"`.");if(0===r)return t}else r=cf;return n=ff(t)?new Array(t.length):{},sf(t,n,[t],[n],r)},hf=lf,pf=Ct;var yf=function(t){return"object"==typeof t&&null!==t&&!pf(t)},vf=Zt,gf=un,wf=f,df=y,bf=Object.prototype;var mf=function(t){var r;return!!yf(t)&&(!(r=gf(t))||!wf(t,"constructor")&&wf(r,"constructor")&&vf(r.constructor)&&"[object Function]"===df(r.constructor)&&wf(r,"isPrototypeOf")&&vf(r.isPrototypeOf)&&(r===bf||function(t){var r;for(r in t)if(!wf(t,r))return!1;return!0}(t)))},Af=mf,Ef=f,_f=J.isPrimitive;var Of={url:"https://stdlib.io/docs/api/latest/error-decoder.html",message:"Minified stdlib error code: {{code}}. Visit {{url}} for the full message."},Pf=ur,jf=hf,Rf=function(t,r){return Af(r)?Ef(r,"url")&&(t.url=r.url,!_f(t.url))?new TypeError("invalid option. `url` option must be a string primitive. Option: `"+t.url+"`."):Ef(r,"message")&&(t.message=r.message,!_f(t.message))?new TypeError("invalid option. `message` option must be a string primitive. Option: `"+t.message+"`."):null:new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.")},Tf=Of;var Uf=function(t){var r,n;if(r=jf(Tf),n=Rf(r,t))throw n;return function(){var t,n,e=arguments[0],o=r.url+"?code="+e;for(n=1;n\n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasSymbols = require( '@stdlib/assert-has-symbol-support' );\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `toStringTag` support.\n*\n* @module @stdlib/assert-has-tostringtag-support\n*\n* @example\n* var hasToStringTagSupport = require( '@stdlib/assert-has-tostringtag-support' );\n*\n* var bool = hasToStringTagSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasToStringTagSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nmodule.exports = toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object has a specified property.\n*\n* @module @stdlib/assert-has-own-property\n*\n* @example\n* var hasOwnProp = require( '@stdlib/assert-has-own-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* bool = hasOwnProp( beep, 'bop' );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasOwnProp = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nmodule.exports = toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar toStringTag = require( './tostringtag.js' );\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* var nativeClass = require( '@stdlib/utils-native-class' );\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar builtin = require( './native_class.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt8Array = require( '@stdlib/assert-is-int8array' );\nvar INT8_MAX = require( '@stdlib/constants-int8-max' );\nvar INT8_MIN = require( '@stdlib/constants-int8-min' );\nvar GlobalInt8Array = require( './int8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* var INT8_MIN = require( '@stdlib/constants-int8-min' );\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int8Array` support.\n*\n* @module @stdlib/assert-has-int8array-support\n*\n* @example\n* var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\n*\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MODULES //\n\nvar defineProperty = require( './define_property.js' );\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nvar main = ( typeof Object.defineProperty === 'function' ) ? Object.defineProperty : null;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 no-underscore-dangle, no-proto */\n\n'use strict';\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an object. Value: `' + obj + '`.' );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. Property descriptor must be an object. Value: `' + descriptor + '`.' );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* var defineProperty = require( '@stdlib/utils-define-property' );\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nvar hasDefinePropertySupport = require( './has_define_property_support.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar defineProperty = require( '@stdlib/utils-define-property' );\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define a non-enumerable read-only property.\n*\n* @module @stdlib/utils-define-nonenumerable-read-only-property\n*\n* @example\n* var setNonEnumerableReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\n\n// MODULES //\n\nvar setNonEnumerableReadOnly = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar valueOf = require( './valueof.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2valueof.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' );\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isObject;\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isString = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isString, 'isPrimitive', isPrimitive );\nsetReadOnly( isString, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string primitive\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Escape a regular expression string or pattern.\n*\n* @module @stdlib/utils-escape-regexp-string\n*\n* @example\n* var rescape = require( '@stdlib/utils-escape-regexp-string' );\n*\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\n\n// MODULES //\n\nvar rescape = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar RE = /./;\n\n\n// EXPORTS //\n\nmodule.exports = RE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* var isBoolean = require( '@stdlib/assert-is-boolean' );\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* // Use interface to check for boolean primitives...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* // Use interface to check for boolean objects...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isObject;\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isBoolean = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isBoolean, 'isPrimitive', isPrimitive );\nsetReadOnly( isBoolean, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar obj = ( typeof global === 'object' ) ? global : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar getThis = require( './codegen.js' );\nvar Self = require( './self.js' );\nvar Win = require( './window.js' );\nvar Global = require( './global.js' );\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. Must provide a boolean primitive. Value: `'+codegen+'`.' );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: Node.js\n\tif ( Global ) {\n\t\treturn Global;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getGlobal = require( '@stdlib/utils-global' );\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nmodule.exports = nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the global object.\n*\n* @module @stdlib/utils-global\n*\n* @example\n* var getGlobal = require( '@stdlib/utils-global' );\n*\n* var g = getGlobal();\n* // returns {...}\n*/\n\n// MODULES //\n\nvar getGlobal = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar RE = require( './fixtures/re.js' );\nvar nodeList = require( './fixtures/nodelist.js' );\nvar typedarray = require( './fixtures/typedarray.js' );\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* var reFunctionName = require( '@stdlib/regexp-function-name' );\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reFunctionName = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reFunctionName, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar reFunctionName = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nmodule.exports = RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nmodule.exports = f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an array.\n*\n* @module @stdlib/assert-is-array\n*\n* @example\n* var isArray = require( '@stdlib/assert-is-array' );\n*\n* var bool = isArray( [] );\n* // returns true\n*\n* bool = isArray( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isArray = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* var isOdd = require( '@stdlib/assert-is-odd' );\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a function. Value: `' + predicate + '`.' );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' );\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' ).isObjectLikeArray;\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar arrayfun = require( '@stdlib/assert-tools-array-function' );\nvar isObjectLike = require( './main.js' );\n\n\n// MAIN //\n\nsetReadOnly( isObjectLike, 'isObjectLikeArray', arrayfun( isObjectLike ) );\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObjectLike = require( '@stdlib/assert-is-object-like' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a Buffer instance.\n*\n* @module @stdlib/assert-is-buffer\n*\n* @example\n* var isBuffer = require( '@stdlib/assert-is-buffer' );\n*\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* v = isBuffer( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isBuffer = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar RE = require( '@stdlib/regexp-function-name' ).REGEXP;\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine the name of a value's constructor.\n*\n* @module @stdlib/utils-constructor-name\n*\n* @example\n* var constructorName = require( '@stdlib/utils-constructor-name' );\n*\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* v = constructorName( {} );\n* // returns 'Object'\n*\n* v = constructorName( true );\n* // returns 'Boolean'\n*/\n\n// MODULES //\n\nvar constructorName = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* var typeOf = require( '@stdlib/utils-type-of' );\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nvar usePolyfill = require( './check.js' );\nvar typeOf = require( './typeof.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : typeOf;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar typeOf = require( '@stdlib/utils-type-of' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a function.\n*\n* @module @stdlib/assert-is-function\n*\n* @example\n* var isFunction = require( '@stdlib/assert-is-function' );\n*\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\n\n// MODULES //\n\nvar isFunction = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar exec = require( './exec.js' );\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2exec.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar rescape = require( '@stdlib/utils-escape-regexp-string' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isRegExp = require( '@stdlib/assert-is-regexp' );\n\n\n// MAIN //\n\n/**\n* Replace search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string primitive\n* @throws {TypeError} second argument argument must be a string primitive or regular expression\n* @throws {TypeError} third argument must be a string primitive or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* var capitalize = require( '@stdlib/string-capitalize' );\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer);\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be a string primitive. Value: `' + str + '`.' );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = rescape( search );\n\t\tsearch = new RegExp( search, 'g' );\n\t}\n\telse if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( 'invalid argument. Second argument must be a string primitive or regular expression. Value: `' + search + '`.' );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( 'invalid argument. Third argument must be a string primitive or replacement function. Value: `' + newval + '`.' );\n\t}\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Replace search occurrences with a replacement string.\n*\n* @module @stdlib/string-replace\n*\n* @example\n* var replace = require( '@stdlib/string-replace' );\n*\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* str = 'Hello World';\n* out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*/\n\n// MODULES //\n\nvar replace = require( './replace.js' );\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Constructor which returns a `Number` object.\n*\n* @module @stdlib/number-ctor\n*\n* @example\n* var Number = require( '@stdlib/number-ctor' );\n*\n* var v = new Number( 10.0 );\n* // returns \n*/\n\n// MODULES //\n\nvar Number = require( './number.js' );\n\n\n// EXPORTS //\n\nmodule.exports = Number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// EXPORTS //\n\nmodule.exports = Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar Number = require( '@stdlib/number-ctor' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' );\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isObject;\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNumber = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNumber, 'isPrimitive', isPrimitive );\nsetReadOnly( isNumber, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* var FLOAT64_PINF = require( '@stdlib/constants-float64-pinf' );\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* var FLOAT64_NINF = require( '@stdlib/constants-float64-ninf' );\n* // returns -Infinity\n*/\n\n// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar floor = require( '@stdlib/math-base-special-floor' );\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nmodule.exports = floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a finite double-precision floating-point number is an integer.\n*\n* @module @stdlib/math-base-assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/math-base-assert-is-integer' );\n*\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* bool = isInteger( 3.14 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isInteger = require( './is_integer.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar isInt = require( '@stdlib/math-base-assert-is-integer' );\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/assert-is-integer' );\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' );\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isObject;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNonNegativeInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNonNegativeInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isNonNegativeInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar getProto = require( './proto.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar builtin = require( './native.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getProto = require( './detect.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the prototype of a provided object.\n*\n* @module @stdlib/utils-get-prototype-of\n*\n* @example\n* var getPrototype = require( '@stdlib/utils-get-prototype-of' );\n*\n* var proto = getPrototype( {} );\n* // returns {}\n*/\n\n// MODULES //\n\nvar getPrototype = require( './get_prototype_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an `Error` object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `Error` object\n*\n* @example\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isError( {} );\n* // returns false\n*/\nfunction isError( value ) {\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tif ( value instanceof Error ) {\n\t\treturn true;\n\t}\n\t// Walk the prototype tree until we find an object having the desired native class...\n\twhile ( value ) {\n\t\tif ( nativeClass( value ) === '[object Error]' ) {\n\t\t\treturn true;\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `Error` object.\n*\n* @module @stdlib/assert-is-error\n*\n* @example\n* var isError = require( '@stdlib/assert-is-error' );\n*\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* bool = isError( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isError = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 a regular expression to parse a regular expression string.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*/\nfunction reRegExp() {\n\treturn /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/; // eslint-disable-line no-useless-escape\n}\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 regular expression to parse a regular expression string.\n*\n* @module @stdlib/regexp-regexp\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var parts = RE_REGEXP.exec( '/^.*$/ig' );\n* // returns [ '/^.*$/ig', '^.*$', 'ig', 'index': 0, 'input': '/^.*$/ig' ]\n*/\n\n// MAIN //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reRegExp = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reRegExp, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar reRegExp = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Matches parts of a regular expression string.\n*\n* Regular expression: `/^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/`\n*\n* - `/^\\/`\n* - match a string that begins with a `/`\n*\n* - `()`\n* - capture\n*\n* - `(?:)+`\n* - capture, but do not remember, a group of characters which occur one or more times\n*\n* - `\\\\\\/`\n* - match the literal `\\/`\n*\n* - `|`\n* - OR\n*\n* - `[^\\/]`\n* - anything which is not the literal `\\/`\n*\n* - `\\/`\n* - match the literal `/`\n*\n* - `([imgy]*)`\n* - capture any characters matching `imgy` occurring zero or more times\n*\n* - `$/`\n* - string end\n*\n*\n* @constant\n* @type {RegExp}\n* @default /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/\n*/\nvar RE_REGEXP = reRegExp();\n\n\n// EXPORTS //\n\nmodule.exports = RE_REGEXP;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar reRegExp = require( '@stdlib/regexp-regexp' );\n\n\n// MAIN //\n\n/**\n* Parses a regular expression string and returns a new regular expression.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} must provide a regular expression string\n* @returns {(RegExp|null)} regular expression or null\n*\n* @example\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\nfunction reFromString( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Capture the regular expression pattern and any flags:\n\tstr = reRegExp().exec( str );\n\n\t// Create a new regular expression:\n\treturn ( str ) ? new RegExp( str[1], str[2] ) : null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Create a regular expression from a regular expression string.\n*\n* @module @stdlib/utils-regexp-from-string\n*\n* @example\n* var reFromString = require( '@stdlib/utils-regexp-from-string' );\n*\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\n\n// MODULES //\n\nvar reFromString = require( './from_string.js' );\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a double-precision floating-point numeric value is `NaN`.\n*\n* @module @stdlib/math-base-assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/math-base-assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 7.0 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isnan = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is `NaN`.\n*\n* @module @stdlib/assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isObject;\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isnan = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isnan, 'isPrimitive', isPrimitive );\nsetReadOnly( isnan, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isCollection;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isnan = require( '@stdlib/assert-is-nan' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} `fromIndex` must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array-like object. Value: `' + arr + '`.' );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `fromIndex` must be an integer. Value: `' + fromIndex + '`.' );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* var MAX_TYPED_ARRAY_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nmodule.exports = MAX_TYPED_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the first index at which a given element can be found.\n*\n* @module @stdlib/utils-index-of\n*\n* @example\n* var indexOf = require( '@stdlib/utils-index-of' );\n*\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* arr = [ 4, 3, 2, 1 ];\n* idx = indexOf( arr, 5 );\n* // returns -1\n*\n* // Using a `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* // `fromIndex` which exceeds `array` length:\n* arr = [ 1, 2, 3, 4, 2, 5 ];\n* idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* // Negative `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* // Negative `fromIndex` exceeding input `array` length:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* // Array-like objects:\n* var str = 'bebop';\n* idx = indexOf( str, 'o' );\n* // returns 3\n*/\n\n// MODULES //\n\nvar indexOf = require( './index_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar keys = require( './builtin.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.keys !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArguments = require( './main.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnum = require( './native.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' );\nvar isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isEnum = require( './native.js' );\nvar hasStringEnumBug = require( './has_string_enumerability_bug.js' );\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object's own property is enumerable.\n*\n* @module @stdlib/assert-is-enumerable-property\n*\n* @example\n* var isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\n\n// MODULES //\n\nvar isEnumerableProperty = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-uint32-max' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* var isArguments = require( '@stdlib/assert-is-arguments' );\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasArgumentsClass = require( './detect.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar builtin = require( './builtin.js' );\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nmodule.exports = noop;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar noop = require( '@stdlib/utils-noop' );\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isConstructorPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar EXCLUDED_KEYS = require( './excluded_keys.json' );\nvar win = require( './window.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nmodule.exports = w;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof window !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasAutomationEqualityBug = require( './has_automation_equality_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar HAS_WINDOW = require( './has_window.js' );\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = wrapper;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObjectLike = require( '@stdlib/assert-is-object-like' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar HAS_ENUM_PROTO_BUG = require( './has_enumerable_prototype_bug.js' );\nvar HAS_NON_ENUM_PROPS_BUG = require( './has_non_enumerable_properties_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype_wrapper.js' );\nvar NON_ENUMERABLE = require( './non_enumerable.json' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasArgumentsBug = require( './has_arguments_bug.js' );\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar wrapper = require( './builtin_wrapper.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an array of an object's own enumerable property names.\n*\n* @module @stdlib/utils-keys\n*\n* @example\n* var keys = require( '@stdlib/utils-keys' );\n*\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\n\n// MODULES //\n\nvar keys = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.getOwnPropertyNames !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyNames = Object.getOwnPropertyNames;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn propertyNames( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar keys = require( '@stdlib/utils-keys' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n* - In environments lacking support for `Object.getOwnPropertyNames()`, property descriptors are unavailable, and thus all properties can be safely assumed to be enumerable. Hence, we can defer to calling `Object.keys`, which retrieves all own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 an array of an object's own enumerable and non-enumerable property names.\n*\n* @module @stdlib/utils-property-names\n*\n* @example\n* var getOwnPropertyNames = require( '@stdlib/utils-property-names' );\n*\n* var keys = getOwnPropertyNames({\n* 'foo': 'bar',\n* 'beep': 'boop'\n* });\n* // e.g., returns [ 'foo', 'beep' ]\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar bool = ( typeof Object.getOwnPropertyDescriptor !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyDescriptor = Object.getOwnPropertyDescriptor;\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tvar desc;\n\tif ( value === null || value === void 0 ) {\n\t\treturn null;\n\t}\n\tdesc = propertyDescriptor( value, property );\n\treturn ( desc === void 0 ) ? null : desc;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n* - In environments lacking `Object.getOwnPropertyDescriptor()` support, property descriptors do not exist. In non-supporting environment, if an object has a provided property, this function returns a descriptor object equivalent to that returned in a supporting environment; otherwise, the function returns `null`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tif ( hasOwnProp( value, property ) ) {\n\t\treturn {\n\t\t\t'configurable': true,\n\t\t\t'enumerable': true,\n\t\t\t'writable': true,\n\t\t\t'value': value[ property ]\n\t\t};\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 property descriptor for an object's own property.\n*\n* @module @stdlib/utils-property-descriptor\n*\n* @example\n* var getOwnPropertyDescriptor = require( '@stdlib/utils-property-descriptor' );\n*\n* var obj = {\n* 'foo': 'bar',\n* 'beep': 'boop'\n* };\n*\n* var keys = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':'bar'}\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Buffer === 'function' ) ? Buffer : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar GlobalBuffer = require( './buffer.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Buffer` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Buffer` support\n*\n* @example\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\nfunction hasNodeBufferSupport() {\n\tvar bool;\n\tvar b;\n\n\tif ( typeof GlobalBuffer !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tif ( typeof GlobalBuffer.from === 'function' ) {\n\t\t\tb = GlobalBuffer.from( [ 1, 2, 3, 4 ] );\n\t\t} else {\n\t\t\tb = new GlobalBuffer( [ 1, 2, 3, 4 ] ); // Note: this is deprecated behavior starting in Node v6 (see https://nodejs.org/api/buffer.html#buffer_new_buffer_array)\n\t\t}\n\t\tbool = (\n\t\t\tisBuffer( b ) &&\n\t\t\tb[ 0 ] === 1 &&\n\t\t\tb[ 1 ] === 2 &&\n\t\t\tb[ 2 ] === 3 &&\n\t\t\tb[ 3 ] === 4\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasNodeBufferSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Buffer` support.\n*\n* @module @stdlib/assert-has-node-buffer-support\n*\n* @example\n* var hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\n*\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasNodeBufferSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write (browser) polyfill\n\n// MAIN //\n\n/**\n* Buffer constructor.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Buffer constructor.\n*\n* @module @stdlib/buffer-ctor\n*\n* @example\n* var ctor = require( '@stdlib/buffer-ctor' );\n*\n* var b = new ctor( [ 1, 2, 3, 4 ] );\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\nvar main = require( './buffer.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasNodeBufferSupport() ) {\n\tctor = main;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = require( 'buffer' ).Buffer; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn Buffer.from( buffer );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn new Buffer( buffer ); // eslint-disable-line no-buffer-constructor\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy buffer data to a new `Buffer` instance.\n*\n* @module @stdlib/buffer-from-buffer\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n* var copyBuffer = require( '@stdlib/buffer-from-buffer' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = copyBuffer( b1 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFrom = require( './has_from.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar copyBuffer;\nif ( hasFrom ) {\n\tcopyBuffer = main;\n} else {\n\tcopyBuffer = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = copyBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './int8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint8Array = require( '@stdlib/assert-is-uint8array' );\nvar UINT8_MAX = require( '@stdlib/constants-uint8-max' );\nvar GlobalUint8Array = require( './uint8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\nvar builtin = require( './uint8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8Array` support.\n*\n* @module @stdlib/assert-has-uint8array-support\n*\n* @example\n* var hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\n*\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8ClampedArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint8ClampedArray = require( '@stdlib/assert-is-uint8clampedarray' );\nvar GlobalUint8ClampedArray = require( './uint8clampedarray.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @module @stdlib/array-uint8c\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8c' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' ); // eslint-disable-line id-length\nvar builtin = require( './uint8clampedarray.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8ClampedArray` support.\n*\n* @module @stdlib/assert-has-uint8clampedarray-support\n*\n* @example\n* var hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' );\n*\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt16Array = require( '@stdlib/assert-is-int16array' );\nvar INT16_MAX = require( '@stdlib/constants-int16-max' );\nvar INT16_MIN = require( '@stdlib/constants-int16-min' );\nvar GlobalInt16Array = require( './int16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-min\n* @type {integer32}\n*\n* @example\n* var INT16_MIN = require( '@stdlib/constants-int16-min' );\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT16_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int16\n*\n* @example\n* var ctor = require( '@stdlib/array-int16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\nvar builtin = require( './int16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int16Array === 'function' ) ? Int16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int16Array` support.\n*\n* @module @stdlib/assert-has-int16array-support\n*\n* @example\n* var hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\n*\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint16Array = require( '@stdlib/assert-is-uint16array' );\nvar UINT16_MAX = require( '@stdlib/constants-uint16-max' );\nvar GlobalUint16Array = require( './uint16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 16-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint16\n*\n* @example\n* var ctor = require( '@stdlib/array-uint16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\nvar builtin = require( './uint16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint16Array === 'function' ) ? Uint16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint16Array` support.\n*\n* @module @stdlib/assert-has-uint16array-support\n*\n* @example\n* var hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\n*\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isInt32Array = require( '@stdlib/assert-is-int32array' );\nvar INT32_MAX = require( '@stdlib/constants-int32-max' );\nvar INT32_MIN = require( '@stdlib/constants-int32-min' );\nvar GlobalInt32Array = require( './int32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-min\n* @type {integer32}\n*\n* @example\n* var INT32_MIN = require( '@stdlib/constants-int32-min' );\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT32_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int32\n*\n* @example\n* var ctor = require( '@stdlib/array-int32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\nvar builtin = require( './int32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int32Array === 'function' ) ? Int32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int32Array` support.\n*\n* @module @stdlib/assert-has-int32array-support\n*\n* @example\n* var hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\n*\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isUint32Array = require( '@stdlib/assert-is-uint32array' );\nvar UINT32_MAX = require( '@stdlib/constants-uint32-max' );\nvar GlobalUint32Array = require( './uint32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 32-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint32\n*\n* @example\n* var ctor = require( '@stdlib/array-uint32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\nvar builtin = require( './uint32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Uint32Array === 'function' ) ? Uint32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint32Array` support.\n*\n* @module @stdlib/assert-has-uint32array-support\n*\n* @example\n* var hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\n*\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFloat32Array = require( '@stdlib/assert-is-float32array' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar GlobalFloat32Array = require( './float32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of single-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float32\n*\n* @example\n* var ctor = require( '@stdlib/array-float32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\nvar builtin = require( './float32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Float32Array === 'function' ) ? Float32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float32Array` support.\n*\n* @module @stdlib/assert-has-float32array-support\n*\n* @example\n* var hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\n*\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat64Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isFloat64Array = require( '@stdlib/assert-is-float64array' );\nvar GlobalFloat64Array = require( './float64array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float64\n*\n* @example\n* var ctor = require( '@stdlib/array-float64' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\nvar builtin = require( './float64array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Float64Array === 'function' ) ? Float64Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float64Array` support.\n*\n* @module @stdlib/assert-has-float64array-support\n*\n* @example\n* var hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\n*\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Int8Array = require( '@stdlib/array-int8' );\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar Uint8ClampedArray = require( '@stdlib/array-uint8c' );\nvar Int16Array = require( '@stdlib/array-int16' );\nvar Uint16Array = require( '@stdlib/array-uint16' );\nvar Int32Array = require( '@stdlib/array-int32' );\nvar Uint32Array = require( '@stdlib/array-uint32' );\nvar Float32Array = require( '@stdlib/array-float32' );\nvar Float64Array = require( '@stdlib/array-float64' );\n\n\n// VARIABLES //\n\nvar hash;\n\n\n// FUNCTIONS //\n\n/**\n* Copies an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - array to copy\n* @returns {Int8Array} new array\n*/\nfunction int8array( arr ) {\n\treturn new Int8Array( arr );\n}\n\n/**\n* Copies a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - array to copy\n* @returns {Uint8Array} new array\n*/\nfunction uint8array( arr ) {\n\treturn new Uint8Array( arr );\n}\n\n/**\n* Copies a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - array to copy\n* @returns {Uint8ClampedArray} new array\n*/\nfunction uint8clampedarray( arr ) {\n\treturn new Uint8ClampedArray( arr );\n}\n\n/**\n* Copies an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - array to copy\n* @returns {Int16Array} new array\n*/\nfunction int16array( arr ) {\n\treturn new Int16Array( arr );\n}\n\n/**\n* Copies a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - array to copy\n* @returns {Uint16Array} new array\n*/\nfunction uint16array( arr ) {\n\treturn new Uint16Array( arr );\n}\n\n/**\n* Copies an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - array to copy\n* @returns {Int32Array} new array\n*/\nfunction int32array( arr ) {\n\treturn new Int32Array( arr );\n}\n\n/**\n* Copies a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - array to copy\n* @returns {Uint32Array} new array\n*/\nfunction uint32array( arr ) {\n\treturn new Uint32Array( arr );\n}\n\n/**\n* Copies a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - array to copy\n* @returns {Float32Array} new array\n*/\nfunction float32array( arr ) {\n\treturn new Float32Array( arr );\n}\n\n/**\n* Copies a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - array to copy\n* @returns {Float64Array} new array\n*/\nfunction float64array( arr ) {\n\treturn new Float64Array( arr );\n}\n\n/**\n* Returns a hash of functions for copying typed arrays.\n*\n* @private\n* @returns {Object} function hash\n*/\nfunction typedarrays() {\n\tvar out = {\n\t\t'int8array': int8array,\n\t\t'uint8array': uint8array,\n\t\t'uint8clampedarray': uint8clampedarray,\n\t\t'int16array': int16array,\n\t\t'uint16array': uint16array,\n\t\t'int32array': int32array,\n\t\t'uint32array': uint32array,\n\t\t'float32array': float32array,\n\t\t'float64array': float64array\n\t};\n\treturn out;\n}\n\n\n// MAIN //\n\nhash = typedarrays();\n\n\n// EXPORTS //\n\nmodule.exports = hash;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar regexp = require( '@stdlib/utils-regexp-from-string' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar propertyNames = require( '@stdlib/utils-property-names' );\nvar propertyDescriptor = require( '@stdlib/utils-property-descriptor' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar defineProperty = require( '@stdlib/utils-define-property' );\nvar copyBuffer = require( '@stdlib/buffer-from-buffer' );\nvar typedArrays = require( './typed_arrays.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Clones a class instance.\n*\n* ## Notes\n*\n* - This should **only** be used for simple cases. Any instances with privileged access to variables (e.g., within closures) cannot be cloned. This approach should be considered **fragile**.\n* - The function is greedy, disregarding the notion of a `level`. Instead, the function deep copies all properties, as we assume the concept of `level` applies only to the class instance reference but not to its internal state. This prevents, in theory, two instances from sharing state.\n*\n*\n* @private\n* @param {Object} val - class instance\n* @returns {Object} new instance\n*/\nfunction cloneInstance( val ) {\n\tvar cache;\n\tvar names;\n\tvar name;\n\tvar refs;\n\tvar desc;\n\tvar tmp;\n\tvar ref;\n\tvar i;\n\n\tcache = [];\n\trefs = [];\n\n\tref = Object.create( getPrototypeOf( val ) );\n\tcache.push( val );\n\trefs.push( ref );\n\n\tnames = propertyNames( val );\n\tfor ( i = 0; i < names.length; i++ ) {\n\t\tname = names[ i ];\n\t\tdesc = propertyDescriptor( val, name );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( val[name] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( val[name], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( ref, name, desc );\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( ref );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( ref );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( ref );\n\t}\n\treturn ref;\n}\n\n/**\n* Copies an error object.\n*\n* @private\n* @param {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error - error to copy\n* @returns {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error copy\n*\n* @example\n* var err1 = new TypeError( 'beep' );\n*\n* var err2 = copyError( err1 );\n* // returns \n*/\nfunction copyError( error ) {\n\tvar cache = [];\n\tvar refs = [];\n\tvar keys;\n\tvar desc;\n\tvar tmp;\n\tvar key;\n\tvar err;\n\tvar i;\n\n\t// Create a new error...\n\terr = new error.constructor( error.message );\n\n\tcache.push( error );\n\trefs.push( err );\n\n\t// If a `stack` property is present, copy it over...\n\tif ( error.stack ) {\n\t\terr.stack = error.stack;\n\t}\n\t// Node.js specific (system errors)...\n\tif ( error.code ) {\n\t\terr.code = error.code;\n\t}\n\tif ( error.errno ) {\n\t\terr.errno = error.errno;\n\t}\n\tif ( error.syscall ) {\n\t\terr.syscall = error.syscall;\n\t}\n\t// Any enumerable properties...\n\tkeys = objectKeys( error );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tdesc = propertyDescriptor( error, key );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( error[ key ] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( error[ key ], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( err, key, desc );\n\t}\n\treturn err;\n}\n\n\n// MAIN //\n\n/**\n* Recursively performs a deep copy of an input object.\n*\n* @private\n* @param {*} val - value to copy\n* @param {(Array|Object)} copy - copy\n* @param {Array} cache - an array of visited objects\n* @param {Array} refs - an array of object references\n* @param {NonNegativeInteger} level - copy depth\n* @returns {*} deep copy\n*/\nfunction deepCopy( val, copy, cache, refs, level ) {\n\tvar parent;\n\tvar keys;\n\tvar name;\n\tvar desc;\n\tvar ctor;\n\tvar key;\n\tvar ref;\n\tvar x;\n\tvar i;\n\tvar j;\n\n\tlevel -= 1;\n\n\t// Primitives and functions...\n\tif (\n\t\ttypeof val !== 'object' ||\n\t\tval === null\n\t) {\n\t\treturn val;\n\t}\n\tif ( isBuffer( val ) ) {\n\t\treturn copyBuffer( val );\n\t}\n\tif ( isError( val ) ) {\n\t\treturn copyError( val );\n\t}\n\t// Objects...\n\tname = typeOf( val );\n\n\tif ( name === 'date' ) {\n\t\treturn new Date( +val );\n\t}\n\tif ( name === 'regexp' ) {\n\t\treturn regexp( val.toString() );\n\t}\n\tif ( name === 'set' ) {\n\t\treturn new Set( val );\n\t}\n\tif ( name === 'map' ) {\n\t\treturn new Map( val );\n\t}\n\tif (\n\t\tname === 'string' ||\n\t\tname === 'boolean' ||\n\t\tname === 'number'\n\t) {\n\t\t// If provided an `Object`, return an equivalent primitive!\n\t\treturn val.valueOf();\n\t}\n\tctor = typedArrays[ name ];\n\tif ( ctor ) {\n\t\treturn ctor( val );\n\t}\n\t// Class instances...\n\tif (\n\t\tname !== 'array' &&\n\t\tname !== 'object'\n\t) {\n\t\t// Cloning requires ES5 or higher...\n\t\tif ( typeof Object.freeze === 'function' ) {\n\t\t\treturn cloneInstance( val );\n\t\t}\n\t\treturn {};\n\t}\n\t// Arrays and plain objects...\n\tkeys = objectKeys( val );\n\tif ( level > 0 ) {\n\t\tparent = name;\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tx = val[ key ];\n\n\t\t\t// Primitive, Buffer, special class instance...\n\t\t\tname = typeOf( x );\n\t\t\tif (\n\t\t\t\ttypeof x !== 'object' ||\n\t\t\t\tx === null ||\n\t\t\t\t(\n\t\t\t\t\tname !== 'array' &&\n\t\t\t\t\tname !== 'object'\n\t\t\t\t) ||\n\t\t\t\tisBuffer( x )\n\t\t\t) {\n\t\t\t\tif ( parent === 'object' ) {\n\t\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\t\tdesc.value = deepCopy( x );\n\t\t\t\t\t}\n\t\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t\t} else {\n\t\t\t\t\tcopy[ key ] = deepCopy( x );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Circular reference...\n\t\t\ti = indexOf( cache, x );\n\t\t\tif ( i !== -1 ) {\n\t\t\t\tcopy[ key ] = refs[ i ];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Plain array or object...\n\t\t\tref = ( isArray( x ) ) ? new Array( x.length ) : {};\n\t\t\tcache.push( x );\n\t\t\trefs.push( ref );\n\t\t\tif ( parent === 'array' ) {\n\t\t\t\tcopy[ key ] = deepCopy( x, ref, cache, refs, level );\n\t\t\t} else {\n\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\tdesc.value = deepCopy( x, ref, cache, refs, level );\n\t\t\t\t}\n\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t}\n\t\t}\n\t} else if ( name === 'array' ) {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tcopy[ key ] = val[ key ];\n\t\t}\n\t} else {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\tdefineProperty( copy, key, desc );\n\t\t}\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( copy );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( copy );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( copy );\n\t}\n\treturn copy;\n}\n\n\n// EXPORTS //\n\nmodule.exports = deepCopy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar deepCopy = require( './deep_copy.js' );\n\n\n// MAIN //\n\n/**\n* Copies or deep clones a value to an arbitrary depth.\n*\n* @param {*} value - value to copy\n* @param {NonNegativeInteger} [level=+infinity] - copy depth\n* @throws {TypeError} `level` must be a nonnegative integer\n* @returns {*} value copy\n*\n* @example\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ { 'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\nfunction copy( value, level ) {\n\tvar out;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( level ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `level` must be a nonnegative integer. Value: `' + level + '`.' );\n\t\t}\n\t\tif ( level === 0 ) {\n\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tlevel = PINF;\n\t}\n\tout = ( isArray( value ) ) ? new Array( value.length ) : {};\n\treturn deepCopy( value, out, [value], [out], level );\n}\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy or deep clone a value to an arbitrary depth.\n*\n* @module @stdlib/utils-copy\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ {'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\n\n// MODULES //\n\nvar copy = require( './copy.js' );\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {(Error|null)} error object or null\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );\n\t}\n\tif ( hasOwnProp( options, 'url' ) ) {\n\t\topts.url = options.url;\n\t\tif ( !isString( opts.url ) ) {\n\t\t\treturn new TypeError( 'invalid option. `url` option must be a string primitive. Option: `' + opts.url + '`.' );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'message' ) ) {\n\t\topts.message = options.message;\n\t\tif ( !isString( opts.message ) ) {\n\t\t\treturn new TypeError( 'invalid option. `message` option must be a string primitive. Option: `' + opts.message + '`.' );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a plain object.\n*\n* @module @stdlib/assert-is-plain-object\n*\n* @example\n* var isPlainObject = require( '@stdlib/assert-is-plain-object' );\n*\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* bool = isPlainObject( null );\n* // returns false\n*/\n\n// MODULES //\n\nvar isPlainObject = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar replace = require( '@stdlib/string-replace' );\nvar copy = require( '@stdlib/utils-copy' );\nvar validate = require( './validate.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function which formats an error message for production.\n*\n* @param {Options} options - function options\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {Function} error formatting function\n*\n* @example\n* var opts = {\n* 'url': 'https://stdlib.io/error-decoder.html'\n* };\n*\n* var fcn = factory( opts );\n* // returns \n*/\nfunction factory( options ) {\n\tvar opts;\n\tvar err;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\treturn formatProdErrorMessage;\n\n\t/**\n\t* Formats an error message for production.\n\t*\n\t* @private\n\t* @param {string} code - error code\n\t* @param {*} ...args - error message arguments\n\t* @returns {string} formatted error message\n\t*/\n\tfunction formatProdErrorMessage() {\n\t\tvar code = arguments[ 0 ];\n\t\tvar url = opts.url + '?code='+code;\n\t\tvar msg;\n\t\tvar i;\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\turl += '&arg[]=' + encodeURIComponent( arguments[ i ] );\n\t\t}\n\t\tmsg = replace( opts.message, '{{url}}', url );\n\t\tmsg = replace( msg, '{{code}}', code );\n\t\treturn msg;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Format an error message for production.\n*\n* @module @stdlib/error-tools-fmtprodmsg\n*\n* @example\n* var formatProdErrorMessage = require( '@stdlib/error-tools-fmtprodmsg' );\n*\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar formatProdErrorMessage = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( formatProdErrorMessage, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MODULES //\n\nvar factory = require( './factory.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @name formatProdErrorMessage\n* @type {Function}\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\nvar formatProdErrorMessage = factory( defaults );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","hasSymbols","lib","toStringTag","tostring","Object","prototype","toString","toStr","require$$0","native_class","v","call","has","hasOwnProperty","value","property","toStrTag","hasOwnProp","require$$2","builtin","require$$1","polyfill","isOwn","tag","out","err","nativeClass","hasInt8Array","Int8Array","main","isInt8Array","GlobalInt8Array","bool","arr","INT8_MAX","ctor","defineProperty","has_define_property_support","objectProtoype","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","obj","prop","descriptor","hasValue","hasGet","hasSet","TypeError","__proto__","Error","get","set","configurable","enumerable","writable","primitive","valueOf","String","test","object","isPrimitive","isObject","setReadOnly","isString","require$$3","RE_CHARS","str","s","i","length","replace","substring","re","Boolean","isBoolean","codegen","Function","self_1","self","window_1","window","global","module","exports","getThis","Self","Win","Global","arguments","root","nodeList","document","childNodes","typedarray","RE","check_1","reFunctionName","Array","isArray","isObjectLike","predicate","len","arrayfun","_isBuffer","constructor","isBuffer","REGEXP","match","name","slice","exec","ctorName","typeOf","type","toLowerCase","RegExp","rescape","isFunction","isRegExp","search","newval","Number","isNumber","POSITIVE_INFINITY","NEGATIVE_INFINITY","floor","Math","x","PINF","NINF","isInt","integer","isInteger","isNonNegativeInteger","getProto","getPrototypeOf","proto","reRegExp","isNan","isnan","isCollection","index_of","searchElement","fromIndex","keys","has_arguments_bug","has_builtin","isArguments","bool$8","detect","detect_1","native","propertyIsEnumerable","bool$7","isEnum","hasStringEnumBug","isEnumerableProperty","require$$4","builtin_wrapper","has_enumerable_prototype_bug","has_non_enumerable_properties_bug","is_constructor_prototype","w","indexOf","isConstructorPrototype","EXCLUDED_KEYS","win","bool$4","k","check","hasAutomationEqualityBug","HAS_WINDOW","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","error","NON_ENUMERABLE","wrapper","skipConstructor","skipPrototype","isFcn","p","push","getOwnPropertyNames","propertyNames","getOwnPropertyDescriptor","propertyDescriptor","desc","Buffer","GlobalBuffer","b","from","buffer","hasUint8Array","Uint8Array","isUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ClampedArray","Uint8ClampedArray","isUint8ClampedArray","GlobalUint8ClampedArray","hasInt16Array","Int16Array","isInt16Array","GlobalInt16Array","INT16_MAX","hasUint16Array","Uint16Array","isUint16Array","GlobalUint16Array","UINT16_MAX","hasInt32Array","Int32Array","isInt32Array","GlobalInt32Array","INT32_MAX","hasUint32Array","Uint32Array","isUint32Array","GlobalUint32Array","UINT32_MAX","hasFloat32Array","Float32Array","isFloat32Array","GlobalFloat32Array","hasFloat64Array","Float64Array","isFloat64Array","GlobalFloat64Array","NaN","require$$5","require$$6","require$$7","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","isError","regexp","objectKeys","require$$8","require$$9","require$$10","require$$11","copyBuffer","require$$12","typedArrays","deepCopy","val","copy","cache","refs","level","parent","key","ref","j","tmp","message","stack","code","errno","syscall","copyError","Date","Set","Map","freeze","names","create","isExtensible","preventExtensions","isSealed","seal","isFrozen","cloneInstance","copy_1","objectPrototype","isPrototypeOf","ownProps","validate","opts","options","url","defaults","factory_1","msg","encodeURIComponent","formatProdErrorMessage","hasInt8ArraySupport","format"],"mappings":";+kBAyCA,ICdIA,EDIJ,WACC,MACmB,mBAAXC,QACoB,iBAApBA,OAAQ,OCPPC,GAqBV,ICTAC,EDEA,WACC,OAASH,GAAqC,iBAAvBC,OAAOG,aEf/BC,EALYC,OAAOC,UAAUC,SCAzBC,EAAQC,EAiCZ,IAAAC,EAPA,SAAsBC,GACrB,OAAOH,EAAMI,KAAMD,IC3BhBE,EAAMR,OAAOC,UAAUQ,eAyC3B,ICjBAZ,EDIA,SAAqBa,EAAOC,GAC3B,OACCD,SAKMF,EAAID,KAAMG,EAAOC,IEnCrBC,EAA+B,mBAAXjB,OAA0BA,OAAOG,YAAc,GCAnEe,EAAaT,EACbN,EDIac,ECHbT,EAAQW,EAwDZ,ICpCIC,EAAUC,EACVC,EDKJ,SAAsBX,GACrB,IAAIY,EACAC,EACAC,EAEJ,GAAKd,QACJ,OAAOH,EAAMI,KAAMD,GAEpBa,EAAMb,EAAGR,GACToB,EAAQL,EAAYP,EAAGR,GAGvB,IACCQ,EAAGR,QAAgB,EAClB,MAAQuB,GACT,OAAOlB,EAAMI,KAAMD,GASpB,OAPAc,EAAMjB,EAAMI,KAAMD,GAEbY,EACJZ,EAAGR,GAAgBqB,SAEZb,EAAGR,GAEJsB,GCdRvB,EAjBqBO,IASNa,EAEAF,EChCXO,EAAclB,EAKdmB,EAAsC,mBAAdC,UA6B5B,IClCIC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EFwBJ,SAAsBhB,GACrB,OACGa,GAAgBb,aAAiBc,WACV,uBAAzBF,EAAaZ,IExBXiB,EDEaF,ECsCjB,IAAAA,EA1BA,WACC,IAAIG,EACAC,EAEJ,GAAgC,mBAApBF,EACX,OAAO,EAGR,IACCE,EAAM,IAAIF,EAAiB,CAAE,EAAG,MAAO,KAAMG,MAC7CF,EACCF,EAAaG,IACA,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEpBR/B,EAL0BO,ECZtB2B,EAA8B,mBAAdP,UAA6BA,eAAY,ECAzDQ,ECA0C,mBAA1BhC,OAAOgC,eAAkChC,OAAOgC,eAAiB,KD4BrF,IAAAC,EAbA,WAEC,IAEC,OADAD,EAAgB,GAAI,IAAK,KAClB,EACN,MAAQX,GACT,OAAO,IEiBTN,EALqBf,OAAOgC,eC/BxBE,EAAiBlC,OAAOC,UACxBE,EAAQ+B,EAAehC,SACvBiC,EAAeD,EAAeE,iBAC9BC,EAAeH,EAAeI,iBAC9BC,EAAeL,EAAeM,iBAC9BC,EAAeP,EAAeQ,iBAuFlC,IAAAzB,EAnDA,SAAyB0B,EAAKC,EAAMC,GACnC,IAAI5C,EACA6C,EACAC,EACAC,EAEJ,GAAoB,iBAARL,GAA4B,OAARA,GAAsC,mBAAtBxC,EAAMI,KAAMoC,GAC3D,MAAM,IAAIM,UAAW,+DAAiEN,EAAM,MAE7F,GAA2B,iBAAfE,GAA0C,OAAfA,GAAoD,mBAA7B1C,EAAMI,KAAMsC,GACzE,MAAM,IAAII,UAAW,oEAAsEJ,EAAa,MAyBzG,IAvBAC,EAAa,UAAWD,KAGtBN,EAAahC,KAAMoC,EAAKC,IACxBH,EAAalC,KAAMoC,EAAKC,IAGxB3C,EAAY0C,EAAIO,UAChBP,EAAIO,UAAYhB,SAGTS,EAAKC,GACZD,EAAKC,GAASC,EAAWnC,MAGzBiC,EAAIO,UAAYjD,GAEhB0C,EAAKC,GAASC,EAAWnC,OAG3BqC,EAAW,QAASF,EACpBG,EAAW,QAASH,EAEfC,IAAcC,GAAUC,GAC5B,MAAM,IAAIG,MAAO,wHASlB,OANKJ,GAAUZ,GACdA,EAAa5B,KAAMoC,EAAKC,EAAMC,EAAWO,KAErCJ,GAAUX,GACdA,EAAa9B,KAAMoC,EAAKC,EAAMC,EAAWQ,KAEnCV,GCrEJ5B,EAAUC,EACVC,EAAWH,EAefjB,EAjB+BO,IASbW,EAEAE,EC7Bde,EAAiB5B,EAmCrB,IAAAqB,EAZA,SAAmCkB,EAAKC,EAAMlC,GAC7CsB,EAAgBW,EAAKC,EAAM,CAC1BU,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ9C,MAASA,KCJXb,EAL+BO,ECA/B,IAAAqD,EAPA,SAAmB/C,GAClB,MAA0B,iBAAVA,GCbbgD,ECDUC,OAAO1D,UAAUyD,QDyB/B,IEvBIpC,EAAcN,EACd4C,EFUJ,SAAelD,GACd,IAEC,OADAgD,EAAQnD,KAAMG,IACP,EACN,MAAQW,GACT,OAAO,IEVL3B,EAPiBU,IA0CrB,IAAAyD,EAhBA,SAAmBnD,GAClB,MAAsB,iBAAVA,IACNA,aAAiBiD,SAGjBjE,EACGkE,EAAMlD,GAEoB,oBAAzBY,EAAaZ,MClCpBoD,EAAc1D,EACd2D,EAAW/C,EA0Bf,ICSIgD,EAAc5D,EACd6D,EDjBJ,SAAmBvD,GAClB,OAASoD,EAAapD,IAAWqD,EAAUrD,ICkBxCqD,EAAWG,EAKfF,EAAaC,EAAU,cANLnD,GAOlBkD,EAAaC,EAAU,WAAYF,GAKnC,IAAAlE,EAAiBoE,EClDbA,EAAW7D,EAAsC0D,YAKjDK,EAAW,yBAqDf,ICzCAtE,EDIA,SAAkBuE,GACjB,IACIC,EACAC,EAEJ,IAAML,EAAUG,GACf,MAAM,IAAInB,UAAW,uEAAyEmB,EAAM,MAGrG,GAAkB,MAAbA,EAAK,GAGT,IAAME,EADAF,EAAIG,OACI,EAAGD,GAAK,GACH,MAAbF,EAAKE,GADcA,KAO1B,YAAW,IAANA,GAAgBA,GAAK,EAClBF,EAAII,QAASL,EAAU,SAM/BE,GAHAA,EAAID,EAAIK,UAAW,EAAGH,IAGhBE,QAASL,EAAU,QAGzBC,EAAMA,EAAK,GAAMC,EAAID,EAAIK,UAAWH,KE/CrCI,GALS,ICyBT,IAAAjB,GAPA,SAAoB/C,GACnB,MAA0B,kBAAVA,GCjBbR,GCDWyE,QAAQ1E,UAAUC,SDyBjC,IEvBIoB,GAAcN,EACd4C,GFUJ,SAAelD,GACd,IAEC,OADAR,GAASK,KAAMG,IACR,EACN,MAAQW,GACT,OAAO,IEVL3B,GAPiBU,IA0CrB,IAAAyD,GAhBA,SAAoBnD,GACnB,MAAsB,iBAAVA,IACNA,aAAiBiE,UAGjBjF,GACGkE,GAAMlD,GAEoB,qBAAzBY,GAAaZ,MClCpBoD,GAAc1D,GACd2D,GAAW/C,GAkCf,ICAIgD,GAAc5D,EACdwE,GDRJ,SAAoBlE,GACnB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICSxCqD,GAAWG,GAKfF,GAAaY,GAAW,cANN9D,IAOlBkD,GAAaY,GAAW,WAAYb,IAKpC,IAAAlE,GAAiB+E,GCpCjB,IAAAC,GAPA,WACC,OAAO,IAAIC,SAAU,eAAd,ICFRC,GAL4B,iBAATC,KAAsBA,KAAO,KCKhDC,GAL8B,iBAAXC,OAAwBA,OAAS,6GCAhDvC,GAA0B,iBAAXwC,GAAwBA,GAAS,KAKpDC,OAAOC,QAAU1C,OCLbiC,GAAYxE,GAAuC0D,YACnDwB,GAAUtE,GACVuE,GAAOzE,GACP0E,GAAMtB,GACNuB,sCAkDJ,IAAAhE,GA7BA,SAAoBoD,GACnB,GAAKa,UAAUnB,OAAS,CACvB,IAAMK,GAAWC,GAChB,MAAM,IAAI5B,UAAW,+DAA+D4B,EAAQ,MAE7F,GAAKA,EACJ,OAAOS,KAKT,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,MAAM,IAAItC,MAAO,uDC3CdwC,GCOYvF,KDNZwF,GAAWD,GAAKE,UAAYF,GAAKE,SAASC,WER1CC,GAAavE,UCEbwE,GAAK5F,GACLwF,GHUaA,GGTbG,GDCaA,GC6BjB,IAAAE,GAnBA,WACC,MAEe,mBAAPD,IAGe,iBAAfD,IAGa,mBAAbH,ICST,IAAAnE,GAPA,WACC,MAAO,2BCEJyE,GAAiBlF,GADHZ,EAOL8F,GAAgB,SCjCR9F,MDsCrB,IAAAP,GAAiBqG,GEtCb5E,GAAclB,EAwClB,ICpBAP,GDWKsG,MAAMC,QACND,MAAMC,QARX,SAAkB1F,GACjB,MAAkC,mBAAzBY,GAAaZ,IEzBnB0F,GAAUhG,GC0Bd,ICGIiG,GDbJ,SAAuB3F,GACtB,OACW,OAAVA,GACiB,iBAAVA,GCQSN,EAOLiG,GAAc,oBFR3B,SAAmBC,GAClB,GAA0B,mBAAdA,EACX,MAAM,IAAIrD,UAAW,sDAAwDqD,EAAY,MAE1F,OASA,SAAgB5F,GACf,IAAI6F,EACAjC,EACJ,IAAM8B,GAAS1F,GACd,OAAO,EAGR,GAAa,KADb6F,EAAM7F,EAAM6D,QAEX,OAAO,EAER,IAAMD,EAAI,EAAGA,EAAIiC,EAAKjC,IACrB,IAAiC,IAA5BgC,EAAW5F,EAAO4D,IACtB,OAAO,EAGT,OAAO,GEpBuCkC,CAAUH,KAK1D,IAAAxG,GAAiBwG,GCvCbA,GAAejG,GA+CnB,IC3BAP,GDOA,SAAmBa,GAClB,OACC2F,GAAc3F,KAGbA,EAAM+F,WAEL/F,EAAMgG,aAGgC,mBAA/BhG,EAAMgG,YAAYC,UACzBjG,EAAMgG,YAAYC,SAAUjG,KEtC5BY,GAAclB,EACd4F,GAAKhF,GAA0C4F,OAC/CD,GAAW7F,GAuDf,IAAAW,GAxBA,SAA0BnB,GACzB,IAAIuG,EACAC,EACA/E,EAEJ,IAAe,YADf+E,EAAOxF,GAAahB,GAAIyG,MAAO,GAAI,KACC,UAATD,IAAqBxG,EAAEoG,YAAc,CAE/D,GAA0B,iBAD1B3E,EAAOzB,EAAEoG,aACQI,KAChB,OAAO/E,EAAK+E,KAGb,GADAD,EAAQb,GAAGgB,KAAMjF,EAAK7B,YAErB,OAAO2G,EAAO,GAGhB,OAAKF,GAAUrG,GACP,SAEDwG,GCnDJG,GCkBkB7G,GDmCtB,IErDI6G,GDkBkB7G,GCAtB,ICFI8G,GHkBJ,SAAiB5G,GAChB,IAAI6G,EAGJ,OAAW,OAAN7G,EACG,OAKM,YAHd6G,SAAc7G,GAIN2G,GAAU3G,GAAI8G,cAEfD,GG9BJlG,GDNJ,SAAiBX,GAChB,OAAO2G,GAAU3G,GAAI8G,eCetBvH,GAZkBO,KAOaa,GAAWiG,GCtBtCA,GAAS9G,GA2Bb,ICNAP,GDFA,SAAqBa,GAEpB,MAA6B,aAApBwG,GAAQxG,IErBdsG,GCFOK,OAAOpH,UAAU+G,KD0B5B,IEvBI1F,GAAcN,EACd4C,GFUJ,SAAelD,GACd,IAEC,OADAsG,GAAKzG,KAAMG,IACJ,EACN,MAAQW,GACT,OAAO,IEVL3B,GAPiBU,IA0CrB,IC1CIkH,GAAUlH,EACVmH,GAAavG,GACbiD,GAAWnD,EAAsCgD,YACjD0D,GDuBJ,SAAmB9G,GAClB,MAAsB,iBAAVA,IACNA,aAAiB2G,SAGjB3H,GACGkE,GAAMlD,GAEoB,oBAAzBY,GAAaZ,MC2BxB,ICvCAb,GDmBA,SAAkBuE,EAAKqD,EAAQC,GAC9B,IAAMzD,GAAUG,GACf,MAAM,IAAInB,UAAW,wEAA0EmB,EAAM,MAEtG,GAAKH,GAAUwD,GACdA,EAASH,GAASG,GAClBA,EAAS,IAAIJ,OAAQI,EAAQ,UAEzB,IAAMD,GAAUC,GACpB,MAAM,IAAIxE,UAAW,+FAAiGwE,EAAS,MAEhI,IAAMxD,GAAUyD,KAAaH,GAAYG,GACxC,MAAM,IAAIzE,UAAW,gGAAkGyE,EAAS,MAEjI,OAAOtD,EAAII,QAASiD,EAAQC,IEhC7B,IAAAjE,GAPA,SAAmB/C,GAClB,MAA0B,iBAAVA,GCAjBb,GCjBiB8H,OCAbzH,GCASE,GAMSH,UAAUC,SDkBhC,IEvBIoB,GAAcN,EACd2G,GAAS7G,GACT8C,GFSJ,SAAelD,GACd,IAEC,OADAR,GAASK,KAAMG,IACR,EACN,MAAQW,GACT,OAAO,IETL3B,GARiBU,IA2CrB,IAAAyD,GAhBA,SAAmBnD,GAClB,MAAsB,iBAAVA,IACNA,aAAiBiH,KAGjBjI,GACGkE,GAAMlD,GAEoB,oBAAzBY,GAAaZ,MCnCpBoD,GAAc1D,GACd2D,GAAW/C,GAkCf,ICOIgD,GAAc5D,EACdwH,GDfJ,SAAmBlH,GAClB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICgBxCqD,GAAWG,GAKfF,GAAa4D,GAAU,cANL9G,IAOlBkD,GAAa4D,GAAU,WAAY7D,IAKnC,IAAAlE,GAAiB+H,GCvBjB/H,GALmB8H,OAAOE,kBCS1BhI,GA1BaO,GAqBa0H,kBChCtBC,GCsBQC,KAAKD,MDIjB,IENAlI,GFDA,SAAoBoI,GACnB,OAAQF,GAAME,KAAOA,GGpBlBC,GAAO9H,GACP+H,GAAOnH,GACPoH,GAAQtH,GAuBZ,IAAAuH,GAXA,SAAoB3H,GACnB,OACCA,EAAQwH,IACRxH,EAAQyH,IACRC,GAAO1H,IClBLkH,GAAWxH,GAAsC0D,YACjDsE,GAAQpH,GA6BZ,IAAAyC,GAVA,SAAoB/C,GACnB,OACCkH,GAAUlH,IACV0H,GAAO1H,ICvBLkH,GAAWxH,GAAsC2D,SACjDqE,GAAQpH,GA6BZ,IAAA6C,GAVA,SAAoBnD,GACnB,OACCkH,GAAUlH,IACV0H,GAAO1H,EAAMgD,YCvBXI,GAAc1D,GACd2D,GAAW/C,GAkCf,ICMIgD,GAAc5D,EACdkI,GDdJ,SAAoB5H,GACnB,OAASoD,GAAapD,IAAWqD,GAAUrD,ICexCqD,GAAWG,GAKfF,GAAasE,GAAW,cANNxH,IAOlBkD,GAAasE,GAAW,WAAYvE,IAKpC,IAAAlE,GAAiByI,GCvDbA,GAAYlI,GAAuC0D,YA6BvD,IAAAL,GAVA,SAA+B/C,GAC9B,OACC4H,GAAW5H,IACXA,GAAS,GCtBP4H,GAAYlI,GAAuC2D,SA6BvD,IAAAF,GAVA,SAA+BnD,GAC9B,OACC4H,GAAW5H,IACXA,EAAMgD,WAAa,GCtBjBI,GAAc1D,GACd2D,GAAW/C,GAsCf,ICGIgD,GAAc5D,EACdmI,GDXJ,SAA+B7H,GAC9B,OAASoD,GAAapD,IAAWqD,GAAUrD,ICYxCqD,GAAWG,GAKfF,GAAauE,GAAsB,cANjBzH,IAOlBkD,GAAauE,GAAsB,WAAYxE,IAK/C,IAAAlE,GAAiB0I,GCxDbC,GAAWxI,OAAOyI,eCatB,IAAAC,GARA,SAAmB/F,GAElB,OAAOA,EAAIO,WCPR5B,GAAclB,EACdoI,GAAWxH,GA+Bf,IAAAC,GAnBA,SAAyB0B,GACxB,IAAI+F,EAAQF,GAAU7F,GACtB,OAAK+F,GAAmB,OAAVA,EACNA,EAEgC,sBAAnCpH,GAAaqB,EAAI+D,aAEd/D,EAAI+D,YAAYzG,UAEnB0C,aAAe3C,OACZA,OAAOC,UAGR,MCzBJc,GHIayH,GGHbvH,GAAWH,GCFX0H,GDAapI,GAQAJ,OAAOyI,gBACZ1H,GAEAE,GCoBZ,ICdApB,GDFA,SAAyBa,GACxB,OACCA,QAGO,MAGRA,EAAQV,OAAQU,GAET8H,GAAU9H,KEzBd+H,GAAiBrI,GACjBkB,GAAcN,EAwClB,ICrBAnB,GDAA,SAAkBa,GACjB,GAAsB,iBAAVA,GAAgC,OAAVA,EACjC,OAAO,EAGR,GAAKA,aAAiByC,MACrB,OAAO,EAGR,KAAQzC,GAAQ,CACf,GAA8B,mBAAzBY,GAAaZ,GACjB,OAAO,EAERA,EAAQ+H,GAAgB/H,GAEzB,OAAO,GEdR,IAAAe,GAPA,WACC,MAAO,oCCWJkH,GAAW3H,GADGZ,EAOLuI,GAAU,SChCRvI,UCAX6D,GAAW7D,EAAsC0D,YACjD6E,GFyCaA,GEXjB,ICdA9I,GDAA,SAAuBuE,GACtB,IAAMH,GAAUG,GACf,MAAM,IAAInB,UAAW,uEAAyEmB,EAAM,MAMrG,OAHAA,EAAMuE,KAAW3B,KAAM5C,IAGN,IAAIiD,OAAQjD,EAAI,GAAIA,EAAI,IAAO,MEJjD,IAAA3C,GAPA,SAAgBwG,GACf,OAASA,GAAMA,GCfZL,GAAWxH,GAAsC0D,YACjD8E,GCcQxI,GDmBZ,IAAAqD,GAVA,SAAgB/C,GACf,OACCkH,GAAUlH,IACVkI,GAAOlI,IE3BLkH,GAAWxH,GAAsC2D,SACjD6E,GDcQxI,GCeZ,IAAAyD,GAVA,SAAgBnD,GACf,OACCkH,GAAUlH,IACVkI,GAAOlI,EAAMgD,YCvBXI,GAAc1D,GACd2D,GAAW/C,GAkCf,ICOIgD,GAAc5D,EACdyI,GDfJ,SAAgBnI,GACf,OAASoD,GAAapD,IAAWqD,GAAUrD,ICgBxCqD,GAAWG,GAKfF,GAAa6E,GAAO,cANF/H,IAOlBkD,GAAa6E,GAAO,WAAY9E,IAKhC,IAAAlE,GAAiBgJ,GCxDbP,GAAYlI,GAkChB,IClCIyI,GAAQzI,GACR0I,GDmBJ,SAAuBpI,GACtB,MACkB,iBAAVA,GACG,OAAVA,GACwB,iBAAjBA,EAAM6D,QACb+D,GAAW5H,EAAM6D,SACjB7D,EAAM6D,QAAU,GAChB7D,EAAM6D,QENqB,kBDnBzBN,GAAWnD,EAAsCgD,YACjDwE,GAAYpE,GAAuCJ,YA0GvD,IAAAiF,GAhDA,SAAkBlH,EAAKmH,EAAeC,GACrC,IAAI1C,EACAjC,EACJ,IAAMwE,GAAcjH,KAAUoC,GAAUpC,GACvC,MAAM,IAAIoB,UAAW,0EAA4EpB,EAAM,MAGxG,GAAa,KADb0E,EAAM1E,EAAI0C,QAET,OAAQ,EAET,GAA0B,IAArBmB,UAAUnB,OAAe,CAC7B,IAAM+D,GAAWW,GAChB,MAAM,IAAIhG,UAAW,6DAA+DgG,EAAY,MAEjG,GAAKA,GAAa,EAAI,CACrB,GAAKA,GAAa1C,EACjB,OAAQ,EAETjC,EAAI2E,OAEJ3E,EAAIiC,EAAM0C,GACD,IACR3E,EAAI,QAINA,EAAI,EAGL,GAAKuE,GAAOG,IACX,KAAQ1E,EAAIiC,EAAKjC,IAChB,GAAKuE,GAAOhH,EAAIyC,IACf,OAAOA,OAIT,KAAQA,EAAIiC,EAAKjC,IAChB,GAAKzC,EAAKyC,KAAQ0E,EACjB,OAAO1E,EAIV,OAAQ,GErDTzE,GALcO,GClBd,IAAAW,GAPA,SAAeL,GACd,OAAOV,OAAOkJ,KAAMlJ,OAAQU,KCrBzBwI,GAAO9I,GAmCX,IAAA+I,GAPA,WACC,OAlBD,WACC,OAA8C,KAArCD,GAAMxD,YAAe,IAAKnB,OAiB5BX,CAAM,EAAG,ICxBjBwF,QALoC,IAAhBpJ,OAAOkJ,KCAvB5H,GAAclB,EA+BlB,IC1BIwB,GD0BJH,GAPA,SAAsBf,GACrB,MAAkC,uBAAzBY,GAAaZ,ICzBnB2I,GAAcjJ,GA2BdkJ,GAPJ,WACC,OAAOD,GAAa3D,WAMd6D,GAKP,IC3BI3H,GD2BJ4H,GAAiB5H,GEDjB6H,GAL2BzJ,OAAOC,UAAUyJ,qBDHxCC,IAvBSvJ,GAiBGG,KAAM,OAAQ,KAW9B,IE5BI0D,GAAW7D,EACXyI,GAAQ7H,GAAmC8C,YAC3CwE,GAAYxH,GAAuCgD,YACnD8F,GAAS1F,GACT2F,GFwBajI,GE6BjB,IAAAH,GAzBA,SAA+Bf,EAAOC,GACrC,IAAIiB,EACJ,OACClB,YAKDkB,EAAOgI,GAAOrJ,KAAMG,EAAOC,KACbkJ,IAAoB5F,GAAUvD,IAIzCmI,GAFFlI,GAAYA,IAGX2H,GAAW3H,IACXA,GAAY,GACZA,EAAWD,EAAM6D,OAGZ3C,IC3BR/B,GAL2BO,GCnBvBS,GAAaT,EACb0J,GAAuB9I,GACvBoF,GAAUtF,GACVwH,GAAYpE,GCiChB,IAAArE,GAjBwBO,GACbY,GDQX,SAAsBN,GACrB,OACW,OAAVA,GACiB,iBAAVA,IACN0F,GAAS1F,IACc,iBAAjBA,EAAM6D,QACb+D,GAAW5H,EAAM6D,SACjB7D,EAAM6D,QAAU,GAChB7D,EAAM6D,QAhCSwF,YAiCflJ,GAAYH,EAAO,YAClBoJ,GAAsBpJ,EAAO,WEtC5B2I,GAAcjJ,GACdW,GAAUC,GAKV+F,GAAQZ,MAAMlG,UAAU8G,MA+B5B,IAAAiD,GAVA,SAAetJ,GACd,OAAK2I,GAAa3I,GACVK,GAASgG,GAAMxG,KAAMG,IAEtBK,GAASL,ICnBjB,ICAAuJ,GAZ2B7J,IDK3B,cCEuC,aCWvC8J,IAlB2B9J,GAKjB,CACTF,SAAY,MAO0B,YCCvC,ICJI0B,GDIJuI,GAPA,SAAiCzJ,GAChC,OAASA,EAAMgG,aAAehG,EAAMgG,YAAYzG,YAAcS,GER3D0J,GAAwB,oBAAXlF,YAA2B,EAASA,ODAjDrE,GAAaT,EACbiK,GAAUrJ,GACVkG,GAASpG,GACTwJ,GAAyBpG,GACzBqG,wPACAC,GCAaJ,GD2CbK,GAzBJ,WACC,IAAIC,EACJ,GAAuB,cAAlBxD,GAAQsD,IACZ,OAAO,EAER,IAAME,KAAKF,GACV,KAEmC,IAAjCH,GAASE,GAAeG,IACxB7J,GAAY2J,GAAKE,IACJ,OAAbF,GAAKE,IACkB,WAAvBxD,GAAQsD,GAAKE,KAEbJ,GAAwBE,GAAKE,IAE7B,MAAQrJ,GACT,OAAO,EAGT,OAAO,EAMDsJ,GAKP,IErDI/I,GAA2B,oBAAXsD,OCAhB0F,GHqDahJ,GGpDb0I,GAAyBtJ,GACzB6J,GDGajJ,GCuBjB,IC5BIyE,GAAejG,GACfS,GAAaG,EACbqI,GAAcvI,GACdgK,GAAqB5G,GACrB6G,GAAyBhB,GACzBO,GDSJ,SAAkB5J,GACjB,IAAoB,IAAfmK,KAAyBD,GAC7B,OAAON,GAAwB5J,GAEhC,IACC,OAAO4J,GAAwB5J,GAC9B,MAAQsK,GACT,OAAO,ICfLC,iHAyEJ,IC7EIlK,GAAUD,GACVoK,GAAUhH,GACVjD,GDuBJ,SAAeP,GACd,IAAIyK,EACAC,EACAC,EACAjK,EACAsJ,EACAY,EACAhH,EAGJ,GADAlD,EAAM,GACDiI,GAAa3I,GAAU,CAE3B,IAAM4D,EAAI,EAAGA,EAAI5D,EAAM6D,OAAQD,IAC9BlD,EAAImK,KAAMjH,EAAEpE,YAGb,OAAOkB,EAER,GAAsB,iBAAVV,GAEX,GAAKA,EAAM6D,OAAS,IAAM1D,GAAYH,EAAO,KAC5C,IAAM4D,EAAI,EAAGA,EAAI5D,EAAM6D,OAAQD,IAC9BlD,EAAImK,KAAMjH,EAAEpE,gBAGR,CAEN,IAAe,KADfmL,EAA2B,mBAAV3K,KACQ2F,GAAc3F,GACtC,OAAOU,EAERgK,EAAkBN,IAAsBO,EAEzC,IAAMX,KAAKhK,EACF0K,GAAuB,cAANV,IAAuB7J,GAAYH,EAAOgK,IAClEtJ,EAAImK,KAAM5H,OAAQ+G,IAGpB,GAAKK,GAEJ,IADAI,EAAkBb,GAAwB5J,GACpC4D,EAAI,EAAGA,EAAI2G,GAAe1G,OAAQD,IACvCgH,EAAIL,GAAgB3G,GACZ6G,GAAyB,gBAANG,IAAyBzK,GAAYH,EAAO4K,IACtElK,EAAImK,KAAM5H,OAAQ2H,IAIrB,OAAOlK,GEnDRvB,GDrBkBmB,GADIZ,KA6Bb8K,GAEAnK,GAGDE,GE7BRmI,QALmD,IAA/BpJ,OAAOwL,oBCAvBC,GAAgBzL,OAAOwL,oBAgC3B,IChCItC,GAAO9I,GCgCX,IAAAP,GAjBkBO,GFUlB,SAA8BM,GAC7B,OAAO+K,GAAezL,OAAQU,KCA/B,SAA8BA,GAC7B,OAAOwI,GAAMlJ,OAAQU,KEtBtB0I,QALwD,IAApCpJ,OAAO0L,yBCAvBC,GAAqB3L,OAAO0L,yBAuChC,ICvCI7K,GAAaT,ECkCjB,IAAAP,GAjBkBO,GFUlB,SAAmCM,EAAOC,GACzC,IAAIiL,EACJ,OAAKlL,cAIa,KADlBkL,EAAOD,GAAoBjL,EAAOC,IAF1B,KAG4BiL,GCLrC,SAAmClL,EAAOC,GACzC,OAAKE,GAAYH,EAAOC,GAChB,CACN2C,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ9C,MAASA,EAAOC,IAGX,o4qBErCJc,GAA0CoK,GAK9CzG,OAAOC,QAAU5D,OCLbkF,GAAWvG,GACX0L,sCA4CJ,IAAArK,GA9BA,WACC,IAAIG,EACAmK,EAEJ,GAA6B,mBAAjBD,GACX,OAAO,EAGR,IAEEC,EADiC,mBAAtBD,GAAaE,KACpBF,GAAaE,KAAM,CAAE,EAAG,EAAG,EAAG,IAE9B,IAAIF,GAAc,CAAE,EAAG,EAAG,EAAG,IAElClK,EACC+E,GAAUoF,IACC,IAAXA,EAAG,IACQ,IAAXA,EAAG,IACQ,IAAXA,EAAG,IACQ,IAAXA,EAAG,GAEH,MAAQ1K,GACTO,GAAO,EAER,OAAOA,GCtBR/B,GAL2BO,GCE3B,ICDIqB,SCb2BoK,ODc3B5K,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GAjB2BO,KASnBqB,GAEAR,GEjBJW,GANaxB,GACJY,GAKiBgL,MCN1BrF,GAAWvG,GACXyL,GAAS7K,GA+Bb,IAAAS,GAVA,SAAqBwK,GACpB,IAAMtF,GAAUsF,GACf,MAAM,IAAIhJ,UAAW,oDAAsDgJ,EAAS,KAErF,OAAOJ,GAAOG,KAAMC,IC1BjBtF,GAAWvG,GACXyL,GAAS7K,GA+Bb,IAAAC,GAVA,SAAqBgL,GACpB,IAAMtF,GAAUsF,GACf,MAAM,IAAIhJ,UAAW,oDAAsDgJ,EAAS,KAErF,OAAO,IAAIJ,GAAQI,ICOpBpM,GHtBiB+B,GGMNZ,GACIF,GCJf,ICDIC,GCb8B,mBAAdS,UAA6BA,eAAY,EDczDP,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GAjB0BO,IASlBW,GAEAE,GEvBJK,GAAclB,EAKd8L,GAAwC,mBAAfC,WA6B7B,IClCI1K,GAA+B,mBAAf0K,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuB1L,GACtB,OACGwL,IAAiBxL,aAAiByL,YACX,wBAAzB7K,GAAaZ,IEzBX2L,GDGa5K,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArBwK,GACX,OAAO,EAGR,IAECxK,EAAM,IAAIwK,GADVxK,EAAM,CAAE,EAAG,MAAO,KAAMyK,IAAaA,MAErC1K,EACCwK,GAAcvK,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQyK,MAAbzK,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCb+B,mBAAfoL,WAA8BA,gBAAa,EDc3DlL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKdmM,GAAsD,mBAAtBC,kBA6BpC,IClCI/K,GAAsC,mBAAtB+K,kBAAqCA,kBAAoB,KCAzEC,GFwBJ,SAA8B/L,GAC7B,OACG6L,IAAwB7L,aAAiB8L,mBAClB,+BAAzBlL,GAAaZ,IE1BXgM,GDIajL,GCuCjB,IAAAA,GA7BA,WACC,IAAIG,EACAC,EAEJ,GAAwC,mBAA5B6K,GACX,OAAO,EAGR,IACC7K,EAAM,IAAI6K,GAAyB,EAAG,EAAG,EAAG,EAAG,KAAM,KAAM,IAAK,MAChE9K,EACC6K,GAAqB5K,IACR,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,MAAbA,EAAK,IACQ,MAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbsC,mBAAtByL,kBAAqCA,uBAAoB,EDczEvL,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjBkCO,KFS1BW,GAEAE,GGvBJK,GAAclB,EAKduM,GAAwC,mBAAfC,WA6B7B,IClCInL,GAA+B,mBAAfmL,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuBnM,GACtB,OACGiM,IAAiBjM,aAAiBkM,YACX,wBAAzBtL,GAAaZ,IExBXoM,GDEarL,GCsCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArBiL,GACX,OAAO,EAGR,IACCjL,EAAM,IAAIiL,GAAkB,CAAE,EAAG,MAAO,KAAMC,QAC9CnL,EACCiL,GAAchL,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,QDDbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEvBR,ICDIb,GCb+B,mBAAf6L,WAA8BA,gBAAa,EDc3D3L,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKd4M,GAA0C,mBAAhBC,YA6B9B,IClCIxL,GAAgC,mBAAhBwL,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBxM,GACvB,OACGsM,IAAkBtM,aAAiBuM,aACZ,yBAAzB3L,GAAaZ,IEzBXyM,GDGa1L,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAkC,mBAAtBsL,GACX,OAAO,EAGR,IAECtL,EAAM,IAAIsL,GADVtL,EAAM,CAAE,EAAG,MAAO,KAAMuL,MAAcA,QAEtCxL,EACCsL,GAAerL,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQuL,QAAbvL,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbgC,mBAAhBkM,YAA+BA,iBAAc,EDc7DhM,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB4BO,KFSpBW,GAEAE,GGvBJK,GAAclB,EAKdiN,GAAwC,mBAAfC,WA6B7B,IClCI7L,GAA+B,mBAAf6L,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuB7M,GACtB,OACG2M,IAAiB3M,aAAiB4M,YACX,wBAAzBhM,GAAaZ,IExBX8M,GDEa/L,GCsCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAiC,mBAArB2L,GACX,OAAO,EAGR,IACC3L,EAAM,IAAI2L,GAAkB,CAAE,EAAG,MAAO,KAAMC,aAC9C7L,EACC2L,GAAc1L,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,aDDbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GEvBR,ICDIb,GCb+B,mBAAfuM,WAA8BA,gBAAa,EDc3DrM,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB2BO,KFSnBW,GAEAE,GGvBJK,GAAclB,EAKdsN,GAA0C,mBAAhBC,YA6B9B,IClCIlM,GAAgC,mBAAhBkM,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBlN,GACvB,OACGgN,IAAkBhN,aAAiBiN,aACZ,yBAAzBrM,GAAaZ,IEzBXmN,GDGapM,GCuCjB,IAAAA,GA5BA,WACC,IAAIG,EACAC,EAEJ,GAAkC,mBAAtBgM,GACX,OAAO,EAGR,IAEChM,EAAM,IAAIgM,GADVhM,EAAM,CAAE,EAAG,MAAO,KAAMiM,WAAcA,aAEtClM,EACCgM,GAAe/L,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQiM,aAAbjM,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQR,GACTO,GAAO,EAER,OAAOA,GCxBR,ICDIb,GCbgC,mBAAhB4M,YAA+BA,iBAAc,EDc7D1M,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB4BO,KFSpBW,GAEAE,GGvBJK,GAAclB,EAKd2N,GAA4C,mBAAjBC,aA6B/B,IClCIvM,GAAiC,mBAAjBuM,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyBvN,GACxB,OACGqN,IAAmBrN,aAAiBsN,cACb,0BAAzB1M,GAAaZ,IE1BXwH,GAAOlH,GACPkN,GDGazM,GCqCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAmC,mBAAvBqM,GACX,OAAO,EAGR,IACCrM,EAAM,IAAIqM,GAAoB,CAAE,EAAK,MAAO,KAAM,OAClDtM,EACCqM,GAAgBpM,IACH,IAAbA,EAAK,IACQ,oBAAbA,EAAK,KACS,oBAAdA,EAAK,IACLA,EAAK,KAAQqG,GAEb,MAAQ7G,GACTO,GAAO,EAER,OAAOA,GCtBR,ICDIb,GCbiC,mBAAjBiN,aAAgCA,kBAAe,EDc/D/M,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCqBlBtD,GEjB6BO,KFSrBW,GAEAE,GGvBJK,GAAclB,EAKd+N,GAA4C,mBAAjBC,aA6B/B,IClCI3M,GAAiC,mBAAjB2M,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyB3N,GACxB,OACGyN,IAAmBzN,aAAiB0N,cACb,0BAAzB9M,GAAaZ,IE1BX4N,GDIa7M,GCoCjB,IAAAA,GA1BA,WACC,IAAIG,EACAC,EAEJ,GAAmC,mBAAvByM,GACX,OAAO,EAGR,IACCzM,EAAM,IAAIyM,GAAoB,CAAE,EAAK,MAAO,KAAMC,MAClD3M,EACCyM,GAAgBxM,IACH,IAAbA,EAAK,IACQ,OAAbA,EAAK,KACS,OAAdA,EAAK,IACLA,EAAK,IAAQA,EAAK,GAElB,MAAQR,GACTO,GAAO,EAER,OAAOA,GCrBR,ICKIG,GANAhB,GCbiC,mBAAjBqN,aAAgCA,kBAAe,EDc/DnN,GDPJ,WACC,MAAM,IAAIkC,MAAO,oBCajBpB,GET4B3B,KFSrBW,GAEAE,GAMR,IG7BIO,GAAYpB,GACZ+L,GAAanL,GACbwL,GAAoB1L,GACpB8L,GAAa1I,GACb+I,GAAclD,GACduD,GAAakB,GACbb,GAAcc,GACdT,GAAeU,GACfN,GHqBarM,GGJjB,SAAS4M,GAAW9M,GACnB,OAAO,IAAIL,GAAWK,GAUvB,SAAS+M,GAAY/M,GACpB,OAAO,IAAIsK,GAAYtK,GAUxB,SAASgN,GAAmBhN,GAC3B,OAAO,IAAI2K,GAAmB3K,GAU/B,SAASiN,GAAYjN,GACpB,OAAO,IAAI+K,GAAY/K,GAUxB,SAASkN,GAAalN,GACrB,OAAO,IAAIoL,GAAapL,GAUzB,SAASmN,GAAYnN,GACpB,OAAO,IAAIyL,GAAYzL,GAUxB,SAASoN,GAAapN,GACrB,OAAO,IAAI8L,GAAa9L,GAUzB,SAASqN,GAAcrN,GACtB,OAAO,IAAImM,GAAcnM,GAU1B,SAASsN,GAActN,GACtB,OAAO,IAAIuM,GAAcvM,GAgC1B,IClJIhB,GAAaT,EACbgG,GAAUpF,GACV2F,GAAW7F,GACXsO,GAAUlL,GACVgD,GAAS6C,GACTsF,GAASb,GACTnE,GAAUoE,GACVa,GAAaZ,GACbjD,GAAgB8D,GAChB5D,GAAqB6D,GACrB/G,GAAiBgH,GACjBzN,GAAiB0N,EACjBC,GAAaC,GACbC,GD+GO,CACTlB,UAAaA,GACbC,WAAcA,GACdC,kBAAqBA,GACrBC,WAAcA,GACdC,YAAeA,GACfC,WAAcA,GACdC,YAAeA,GACfC,aAAgBA,GAChBC,aAAgBA,ICQlB,SAASW,GAAUC,EAAKC,EAAMC,EAAOC,EAAMC,GAC1C,IAAIC,EACAlH,EACApC,EACA8E,EACA7J,EACAsO,EACAC,EACArI,EACA3D,EACAiM,EAKJ,GAHAJ,GAAS,EAIO,iBAARJ,GACC,OAARA,EAEA,OAAOA,EAER,GAAKpJ,GAAUoJ,GACd,OAAOJ,GAAYI,GAEpB,GAAKX,GAASW,GACb,OAnFF,SAAoB/E,GACnB,IAEI9B,EACA0C,EACA4E,EACAH,EACAhP,EACAiD,EAPA2L,EAAQ,GACRC,EAAO,GA8BX,IArBA7O,EAAM,IAAI2J,EAAMtE,YAAasE,EAAMyF,SAEnCR,EAAM1E,KAAMP,GACZkF,EAAK3E,KAAMlK,GAGN2J,EAAM0F,QACVrP,EAAIqP,MAAQ1F,EAAM0F,OAGd1F,EAAM2F,OACVtP,EAAIsP,KAAO3F,EAAM2F,MAEb3F,EAAM4F,QACVvP,EAAIuP,MAAQ5F,EAAM4F,OAEd5F,EAAM6F,UACVxP,EAAIwP,QAAU7F,EAAM6F,SAGrB3H,EAAOoG,GAAYtE,GACb1G,EAAI,EAAGA,EAAI4E,EAAK3E,OAAQD,IAC7B+L,EAAMnH,EAAM5E,GACZsH,EAAOD,GAAoBX,EAAOqF,GAC7BxP,GAAY+K,EAAM,WACtB4E,EAAQpK,GAAS4E,EAAOqF,IAAY,GAAK,GACzCzE,EAAKlL,MAAQoP,GAAU9E,EAAOqF,GAAOG,EAAKP,EAAOC,GAAO,IAEzDlO,GAAgBX,EAAKgP,EAAKzE,GAE3B,OAAOvK,EA0CCyP,CAAWf,GAKnB,GAAc,UAFdjJ,EAAOI,GAAQ6I,IAGd,OAAO,IAAIgB,MAAOhB,GAEnB,GAAc,WAATjJ,EACJ,OAAOuI,GAAQU,EAAI7P,YAEpB,GAAc,QAAT4G,EACJ,OAAO,IAAIkK,IAAKjB,GAEjB,GAAc,QAATjJ,EACJ,OAAO,IAAImK,IAAKlB,GAEjB,GACU,WAATjJ,GACS,YAATA,GACS,WAATA,EAGA,OAAOiJ,EAAIrM,UAGZ,GADA3B,EAAO8N,GAAa/I,GAEnB,OAAO/E,EAAMgO,GAGd,GACU,UAATjJ,GACS,WAATA,EAGA,MAA8B,mBAAlB9G,OAAOkR,OA1KrB,SAAwBnB,GACvB,IAAIE,EACAkB,EACArK,EACAoJ,EACAtE,EACA4E,EACAF,EACAhM,EAUJ,IARA2L,EAAQ,GACRC,EAAO,GAEPI,EAAMtQ,OAAOoR,OAAQ3I,GAAgBsH,IACrCE,EAAM1E,KAAMwE,GACZG,EAAK3E,KAAM+E,GAEXa,EAAQ1F,GAAesE,GACjBzL,EAAI,EAAGA,EAAI6M,EAAM5M,OAAQD,IAC9BwC,EAAOqK,EAAO7M,GACdsH,EAAOD,GAAoBoE,EAAKjJ,GAC3BjG,GAAY+K,EAAM,WACtB4E,EAAQpK,GAAS2J,EAAIjJ,IAAY,GAAK,GACtC8E,EAAKlL,MAAQoP,GAAUC,EAAIjJ,GAAO0J,EAAKP,EAAOC,GAAO,IAEtDlO,GAAgBsO,EAAKxJ,EAAM8E,GAW5B,OATM5L,OAAOqR,aAActB,IAC1B/P,OAAOsR,kBAAmBhB,GAEtBtQ,OAAOuR,SAAUxB,IACrB/P,OAAOwR,KAAMlB,GAETtQ,OAAOyR,SAAU1B,IACrB/P,OAAOkR,OAAQZ,GAETA,EAuIEoB,CAAe3B,GAEhB,GAIR,GADA7G,EAAOoG,GAAYS,GACdI,EAAQ,EAEZ,IADAC,EAAStJ,EACHyJ,EAAI,EAAGA,EAAIrH,EAAK3E,OAAQgM,IAE7BtI,EAAI8H,EADJM,EAAMnH,EAAMqH,IAIZzJ,EAAOI,GAAQe,GAED,iBAANA,GACD,OAANA,GAEU,UAATnB,GACS,WAATA,GAEDH,GAAUsB,GAEM,WAAXmI,GACJxE,EAAOD,GAAoBoE,EAAKM,GAC3BxP,GAAY+K,EAAM,WACtBA,EAAKlL,MAAQoP,GAAU7H,IAExBjG,GAAgBgO,EAAMK,EAAKzE,IAE3BoE,EAAMK,GAAQP,GAAU7H,IAMd,KADZ3D,EAAI+F,GAAS4F,EAAOhI,KAMpBqI,EAAQlK,GAAS6B,GAAQ,IAAI9B,MAAO8B,EAAE1D,QAAW,GACjD0L,EAAM1E,KAAMtD,GACZiI,EAAK3E,KAAM+E,GACK,UAAXF,EACJJ,EAAMK,GAAQP,GAAU7H,EAAGqI,EAAKL,EAAOC,EAAMC,IAE7CvE,EAAOD,GAAoBoE,EAAKM,GAC3BxP,GAAY+K,EAAM,WACtBA,EAAKlL,MAAQoP,GAAU7H,EAAGqI,EAAKL,EAAOC,EAAMC,IAE7CnO,GAAgBgO,EAAMK,EAAKzE,KAd3BoE,EAAMK,GAAQH,EAAM5L,QAiBhB,GAAc,UAATwC,EACX,IAAMyJ,EAAI,EAAGA,EAAIrH,EAAK3E,OAAQgM,IAE7BP,EADAK,EAAMnH,EAAMqH,IACER,EAAKM,QAGpB,IAAME,EAAI,EAAGA,EAAIrH,EAAK3E,OAAQgM,IAC7BF,EAAMnH,EAAMqH,GACZ3E,EAAOD,GAAoBoE,EAAKM,GAChCrO,GAAgBgO,EAAMK,EAAKzE,GAY7B,OATM5L,OAAOqR,aAActB,IAC1B/P,OAAOsR,kBAAmBtB,GAEtBhQ,OAAOuR,SAAUxB,IACrB/P,OAAOwR,KAAMxB,GAEThQ,OAAOyR,SAAU1B,IACrB/P,OAAOkR,OAAQlB,GAETA,EAMR,IC3RI5J,GAAUhG,GACVmI,GAAuBvH,GAAmD8C,YAC1EoE,GAAOpH,GACPgP,GDwRaA,GCtOjB,IAAA6B,GAnBA,SAAejR,EAAOyP,GACrB,IAAI/O,EACJ,GAAKsE,UAAUnB,OAAS,EAAI,CAC3B,IAAMgE,GAAsB4H,GAC3B,MAAM,IAAIlN,UAAW,oEAAsEkN,EAAQ,MAEpG,GAAe,IAAVA,EACJ,OAAOzP,OAGRyP,EAAQjI,GAGT,OADA9G,EAAQgF,GAAS1F,GAAY,IAAIyF,MAAOzF,EAAM6D,QAAW,GAClDuL,GAAUpP,EAAOU,EAAK,CAACV,GAAQ,CAACU,GAAM+O,ICd9CtQ,GALWO,GC5BPgG,GAAUhG,GA8Bd,IC9BI2D,GDmBJ,SAAmBrD,GAClB,MACkB,iBAAVA,GACG,OAAVA,IACC0F,GAAS1F,ICtBR6G,GAAavG,GACbyH,GAAiB3H,GACjBD,GAAaqD,EACb5C,GAAcyI,EAKd6H,GAAkB5R,OAAOC,UAgF7B,IAAAwB,GAvCA,SAAwBf,GACvB,IAAIgI,EAGJ,QAAM3E,GAAUrD,OAIhBgI,EAAQD,GAAgB/H,MAOtBG,GAAYH,EAAO,gBAGpBG,GAAY6H,EAAO,gBACnBnB,GAAYmB,EAAMhC,cACmB,sBAArCpF,GAAaoH,EAAMhC,cAGnB7F,GAAY6H,EAAO,kBACnBnB,GAAYmB,EAAMmJ,iBAIjBnJ,IAAUkJ,IAzDb,SAAmBjP,GAClB,IAAI0N,EAGJ,IAAMA,KAAO1N,EACZ,IAAM9B,GAAY8B,EAAK0N,GACtB,OAAO,EAGT,OAAO,EAmDLyB,CAAUpR,MCjFTqD,GCegB3D,GDdhBS,GAAaG,EACbiD,GAAWnD,EAAsCgD,YAqCrD,wJEvCIU,GAAUpE,GACV4P,GAAOhP,GACP+Q,GFeJ,SAAmBC,EAAMC,GACxB,OAAMlO,GAAUkO,GAGXpR,GAAYoR,EAAS,SACzBD,EAAKE,IAAMD,EAAQC,KACbjO,GAAU+N,EAAKE,MACb,IAAIjP,UAAW,qEAAuE+O,EAAKE,IAAM,MAGrGrR,GAAYoR,EAAS,aACzBD,EAAKvB,QAAUwB,EAAQxB,SACjBxM,GAAU+N,EAAKvB,UACb,IAAIxN,UAAW,yEAA2E+O,EAAKvB,QAAU,MAG3G,KAdC,IAAIxN,UAAW,iEAAmEgP,EAAU,OEhBjGE,GAAWjO,GAwDf,IAAAkO,GAnCA,SAAkBH,GACjB,IAAID,EACA3Q,EAGJ,GAFA2Q,EAAOhC,GAAMmC,IACb9Q,EAAM0Q,GAAUC,EAAMC,GAErB,MAAM5Q,EAEP,OAUA,WACC,IAEIgR,EACA/N,EAHAqM,EAAOjL,UAAW,GAClBwM,EAAMF,EAAKE,IAAM,SAASvB,EAG9B,IAAMrM,EAAI,EAAGA,EAAIoB,UAAUnB,OAAQD,IAClC4N,GAAO,UAAYI,mBAAoB5M,UAAWpB,IAInD,OAFA+N,EAAM7N,GAASwN,EAAKvB,QAAS,UAAWyB,GACxCG,EAAM7N,GAAS6N,EAAK,WAAY1B,KCtC9B4B,GCbUnS,GACCY,IDWGZ,EAOLmS,GAAwB,UALvBzR,IAUd,IAAAjB,GAAiB0S,UEJZC,IACGzR,ECZR,WACC,MAAM,IAAIoC,MAAOsP,GAAQ"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 544b59f..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 78b4cc4..0000000 --- a/stats_node.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From a87ab2acb90d595dd422211941b9db9cc4a75714 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 03:41:52 +0000 Subject: [PATCH 006/145] Auto-generated commit --- README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a0b51a9..b3ebdab 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,11 @@ If no recognized module system is present, access bundle contents via the global ```html ``` @@ -1428,6 +1430,7 @@ var bool = it.next().done; @@ -1551,23 +1555,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd/tree/umd From 531233abe6696cd0dcba5b9d30a3d0cc93f535fe Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 18:35:30 +0000 Subject: [PATCH 007/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 4a7520f..b45b083 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From e6403da1ce335fdd246f0a45c3f47247827d4ee6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 19:04:10 +0000 Subject: [PATCH 008/145] Remove files From d0666dd6cd0760eb75d0e5498e9aba78602b0f3a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 19:05:19 +0000 Subject: [PATCH 009/145] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 33 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 687 ----- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 -- benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ------ docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/int8array.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 2689 +++++++++++++++++ stats_node.html | 2689 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 94 files changed, 5434 insertions(+), 9022 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/int8array.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 6726965..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,687 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the repository: - push: - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch or create new branch tag: - - name: 'Push changes to `deno` branch or create new branch tag' - run: | - SLUG=${{ github.repository }} - VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p') - if [ -z "$VERSION" ]; then - echo "Workflow job was not triggered by a new tag...." - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - else - echo "Workflow job was triggered by a new tag: $VERSION" - echo "Creating new bundle branch tag of the form $VERSION-deno" - git tag -a $VERSION-deno -m "$VERSION-deno" - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno - fi - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..79f08d8 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..ad5f1a2 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 20ddac1..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './int8array.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/int8array.js b/lib/int8array.js deleted file mode 100644 index 667410e..0000000 --- a/lib/int8array.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b45b083..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..c341be0 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..1b582c5 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 63e7fe2..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './int8array.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 31dee0b13b2222e8ea66ff491650dc602a22d4d2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 03:50:50 +0000 Subject: [PATCH 010/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 4a7520f..b45b083 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 445976c9959a792eecc5aa32a1b94c0084431a1f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 11:13:15 +0000 Subject: [PATCH 011/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 2689 -------------------------------------------- stats_node.html | 2689 -------------------------------------------- 6 files changed, 5386 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 79f08d8..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index ad5f1a2..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index c341be0..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 1b582c5..0000000 --- a/stats_node.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 806c8ae1ae67e634401af64b827a92e029652331 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 11:14:00 +0000 Subject: [PATCH 012/145] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 33 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ----- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 -- benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ------ docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/int8array.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 2689 +++++++++++++++++ stats_node.html | 2689 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 5434 insertions(+), 9096 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/int8array.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index d170c00..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-08-01T00:58:00.468Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 5094681..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..79f08d8 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..ad5f1a2 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 20ddac1..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './int8array.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/int8array.js b/lib/int8array.js deleted file mode 100644 index 667410e..0000000 --- a/lib/int8array.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b45b083..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..780a9ea --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..b041c46 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 63e7fe2..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './int8array.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 9a29d3ca2440becd691f56309468e951eb71da4a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 03:23:14 +0000 Subject: [PATCH 013/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 4a7520f..b45b083 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 5610e981b0f6ed8406410ae6d575d40519626bda Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 16:25:02 +0000 Subject: [PATCH 014/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 2689 -------------------------------------------- stats_node.html | 2689 -------------------------------------------- 6 files changed, 5386 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 79f08d8..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index ad5f1a2..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 780a9ea..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index b041c46..0000000 --- a/stats_node.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 284088d7145a912f8eb6d0489a64cf080771d4db Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 16:26:03 +0000 Subject: [PATCH 015/145] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ----- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 -- benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ------ docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/int8array.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 2689 +++++++++++++++++ stats_node.html | 2689 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 5434 insertions(+), 9112 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/int8array.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 560e79a..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-09-01T00:54:30.554Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 5094681..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..79f08d8 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..ad5f1a2 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 20ddac1..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './int8array.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/int8array.js b/lib/int8array.js deleted file mode 100644 index 667410e..0000000 --- a/lib/int8array.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b45b083..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..2ea995b --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..b540140 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 63e7fe2..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './int8array.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From e2fc465e49c739263631b5f32d67df0c809a188d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Sep 2022 18:01:31 +0000 Subject: [PATCH 016/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 4a7520f..b45b083 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 7e39ec8ce05708bfa7aa151cb87d90836b6ed63e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Sep 2022 18:14:07 +0000 Subject: [PATCH 017/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 2689 -------------------------------------------- stats_node.html | 2689 -------------------------------------------- 6 files changed, 5386 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 79f08d8..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index ad5f1a2..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './int8array.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 2ea995b..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index b540140..0000000 --- a/stats_node.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From b88989f7bfc9ed938ca4c6428b6360499d369881 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Sep 2022 18:15:24 +0000 Subject: [PATCH 018/145] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ----- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 -- benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ------ docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 2689 +++++++++++++++++ stats_node.html | 2689 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 94 files changed, 5434 insertions(+), 9111 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 5094681..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..79f08d8 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..ad5f1a2 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b45b083..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..340328c --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..01661b4 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 44240e096c4827411f9f3f7f3e9ca167de599e08 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 04:43:17 +0000 Subject: [PATCH 019/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 4a7520f..b45b083 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 22663b5ac3ef1eb5b16177c92593f0991c187841 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 19:35:11 +0000 Subject: [PATCH 020/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 2689 -------------------------------------------- stats_node.html | 2689 -------------------------------------------- 6 files changed, 5386 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 79f08d8..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index ad5f1a2..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 340328c..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 01661b4..0000000 --- a/stats_node.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From c5b5823397fba70dc5735c9378a43d15e82c8022 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 19:36:14 +0000 Subject: [PATCH 021/145] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ----- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 -- benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ------ docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 2689 +++++++++++++++++ stats_node.html | 2689 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 5434 insertions(+), 9112 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index ae5a958..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-10-01T01:19:21.081Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 5094681..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..79f08d8 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..ad5f1a2 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b45b083..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..0649560 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..d2113d4 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From d87cf87fb79d014cd213ef51fac4d7010337f395 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 02:31:12 +0000 Subject: [PATCH 022/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 4a7520f..b45b083 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From f79debf6f4752ae4b882b55a1da1596d91ddf246 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 18:55:20 +0000 Subject: [PATCH 023/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 2689 -------------------------------------------- stats_node.html | 2689 -------------------------------------------- 6 files changed, 5386 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 79f08d8..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index ad5f1a2..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,EAClB,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,GASpB,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,GC1BR,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,ICtBhBQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQL,GACTI,GAAO,EAER,OAAOA,EXjBHK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,EDTUG,CAAQ,WbmBXrC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 0649560..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index d2113d4..0000000 --- a/stats_node.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From b65eba10978a815f61bbd62f7c2f8e283275dc2d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 18:56:18 +0000 Subject: [PATCH 024/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ---- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 4044 +++++++++++++++++ stats_node.html | 4044 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 8144 insertions(+), 9112 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index b516394..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-01T01:07:39.357Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9113bfe..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..79f08d8 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..ad5f1a2 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b45b083..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..2c08d10 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..d4a2a41 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From dc7fdf404c9de56834e2932504b431f1930dd6ea Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 3 Nov 2022 21:29:54 +0000 Subject: [PATCH 025/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 4a7520f..b45b083 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From e09930ec40e8a1ccae5e93f7a6135a901115ab89 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 10:05:00 +0000 Subject: [PATCH 026/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4044 -------------------------------------------- stats_node.html | 4044 -------------------------------------------- 6 files changed, 8096 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 79f08d8..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index ad5f1a2..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 2c08d10..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index d4a2a41..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 58a810e65a3e89f1e1840274db5fa05424aa4135 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 10:05:53 +0000 Subject: [PATCH 027/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 781 ---- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 4044 +++++++++++++++++ stats_node.html | 4044 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 8144 insertions(+), 9133 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 837be09..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-03T21:29:17.650Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 37ddb4f..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,781 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..79f08d8 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..ad5f1a2 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b45b083..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..57d52d8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..1d7cbc0 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 073d105d6b66c212c2656dde41719247ab2ad350 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 01:20:08 +0000 Subject: [PATCH 028/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 18a1357..5641c28 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From d55277ba29750c7e6fed4a66ea662d9bc3d46d93 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 13:55:39 +0000 Subject: [PATCH 029/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4044 -------------------------------------------- stats_node.html | 4044 -------------------------------------------- 6 files changed, 8096 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 79f08d8..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index ad5f1a2..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8' ;\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support' ;\nimport builtin from './main.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class' ;\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support' ;\nimport builtin from './native_class.js' ;\nimport polyfill from './polyfill.js' ;\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property' ;\nimport toStringTag from './tostringtag.js' ;\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js' ;\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class' ;\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array' ;\nimport INT8_MAX from '@stdlib/constants-int8-max' ;\nimport INT8_MIN from '@stdlib/constants-int8-min' ;\nimport GlobalInt8Array from './int8array.js' ;\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min' ;\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 57d52d8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 1d7cbc0..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 8cd346712b63d6c3a035eeae4ddfecaf368ff35b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 13:56:35 +0000 Subject: [PATCH 030/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 781 ---- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 183 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 4044 +++++++++++++++++ stats_node.html | 4044 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 8144 insertions(+), 9138 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 15cfe72..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-12-01T01:19:38.167Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 37ddb4f..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,781 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..79f08d8 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..ad5f1a2 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 5641c28..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "2.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..55fa20a --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..694ce01 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 1d6badc27459351f2c1c28e4cd112aa71a9cd28b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 03:33:02 +0000 Subject: [PATCH 031/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index a736c5b..97a6a08 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 42e08bbc60103afc18dbf32199072e1826519fcd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 11:23:24 +0000 Subject: [PATCH 032/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4044 -------------------------------------------- stats_node.html | 4044 -------------------------------------------- 6 files changed, 8096 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 79f08d8..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index ad5f1a2..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 55fa20a..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 694ce01..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From b91b3e58cf001f1cae6a0b29f4a5f012d6396cdb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 11:24:12 +0000 Subject: [PATCH 033/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 791 ---- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 184 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 4044 +++++++++++++++++ stats_node.html | 4044 +++++++++++++++++ test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 8144 insertions(+), 9149 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 89a2221..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-01-01T00:57:59.548Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4eea88..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,791 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..8e2c610 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1aa5e9f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 97a6a08..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..1742b21 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..93e25ea --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From c6077a194a5732722fd4246d8a1e48e876c34646 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 03:39:06 +0000 Subject: [PATCH 034/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index a736c5b..97a6a08 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x" + "@stdlib/assert-has-int8array-support": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.x", @@ -94,4 +95,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From c71703a576cdb8ec847ba66868ecaa95c6693dce Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 11:43:04 +0000 Subject: [PATCH 035/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4044 -------------------------------------------- stats_node.html | 4044 -------------------------------------------- 6 files changed, 8096 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 8e2c610..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1aa5e9f..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 1742b21..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 93e25ea..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 6953d6853defb0466207b543c30521555739f7cf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 11:43:56 +0000 Subject: [PATCH 036/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 791 --- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 184 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 12410 insertions(+), 9149 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 431a7d5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-02-01T01:14:03.106Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4eea88..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,791 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index ed4ffaf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -click B href "https://github.com/stdlib-js/array-int8/tree/main" -click C href "https://github.com/stdlib-js/array-int8/tree/production" -click D href "https://github.com/stdlib-js/array-int8/tree/esm" -click E href "https://github.com/stdlib-js/array-int8/tree/deno" -click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..8e2c610 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1aa5e9f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 97a6a08..53a92dd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.x", - "@stdlib/assert-is-arraybuffer": "^0.0.x", - "@stdlib/assert-is-boolean": "^0.0.x", - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/assert-is-int8array": "^0.0.x", - "@stdlib/assert-is-nonnegative-integer": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/math-base-special-round": "^0.0.x", - "@stdlib/random-base-randi": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/symbol-iterator": "^0.0.x", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..81f7e67 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..0c13f0b --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From a095910fcf874bacdea929125b49dd79ebfaf9d5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 03:50:55 +0000 Subject: [PATCH 037/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 48552bd..538ae0a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8" + "@stdlib/assert-has-int8array-support": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.7", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d30ea95129889efb59cc9198cfb0bf43ba275c88 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 09:07:36 +0000 Subject: [PATCH 038/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 8e2c610..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1aa5e9f..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 81f7e67..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 0c13f0b..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7c3a88282b0b87c2889a46b576ab4556ebc52bdf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 09:08:17 +0000 Subject: [PATCH 039/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 236 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 12410 insertions(+), 9284 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 2eb3981..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-03-01T02:29:12.304Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..8e2c610 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1aa5e9f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 538ae0a..5a13cb4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.7", - "@stdlib/assert-is-arraybuffer": "^0.0.8", - "@stdlib/assert-is-boolean": "^0.0.8", - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/assert-is-int8array": "^0.0.8", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/math-base-special-round": "^0.0.7", - "@stdlib/random-base-randi": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/symbol-iterator": "^0.0.7", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..33827f3 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..8c30ac4 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From fe93be83e757d33318634a55c89d5b33375192b7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 04:10:29 +0000 Subject: [PATCH 040/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 48552bd..538ae0a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8" + "@stdlib/assert-has-int8array-support": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.7", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 528694c1474acaf752504cc996a5c07c98c747c8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 08:58:35 +0000 Subject: [PATCH 041/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 8e2c610..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1aa5e9f..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 33827f3..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 8c30ac4..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2067fe469b3e047d41d2be8413cf47268ae3f1d3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 08:59:30 +0000 Subject: [PATCH 042/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 12410 insertions(+), 9290 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 89c18f7..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-04-01T02:46:50.844Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..8e2c610 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1aa5e9f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 538ae0a..5a13cb4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.7", - "@stdlib/assert-is-arraybuffer": "^0.0.8", - "@stdlib/assert-is-boolean": "^0.0.8", - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/assert-is-int8array": "^0.0.8", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/math-base-special-round": "^0.0.7", - "@stdlib/random-base-randi": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/symbol-iterator": "^0.0.7", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..591cadf --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..832239c --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From cb1bf52cff56121ecf140b444990edfcf6e1bbf4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 04:00:35 +0000 Subject: [PATCH 043/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 48552bd..538ae0a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8" + "@stdlib/assert-has-int8array-support": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.7", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e35345d8066d21e9b1b37d2e2b9a0c0430d6fc54 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 08:53:33 +0000 Subject: [PATCH 044/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 8e2c610..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1aa5e9f..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 591cadf..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 832239c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d4c0a8d560378f0c1d4b2a1366541d6c9224cbc0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 08:54:22 +0000 Subject: [PATCH 045/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 12410 insertions(+), 9290 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index ece74ed..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-05-01T02:40:25.978Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..8e2c610 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1aa5e9f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 538ae0a..5a13cb4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.7", - "@stdlib/assert-is-arraybuffer": "^0.0.8", - "@stdlib/assert-is-boolean": "^0.0.8", - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/assert-is-int8array": "^0.0.8", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/math-base-special-round": "^0.0.7", - "@stdlib/random-base-randi": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/symbol-iterator": "^0.0.7", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..c9951d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..558fdd5 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 6c69e125c1913604b37bca9c82d4328b6cfaed99 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 03:52:10 +0000 Subject: [PATCH 046/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 48552bd..538ae0a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8" + "@stdlib/assert-has-int8array-support": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.7", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 5a51bea3832c17b6379f7a9129343cdefe537e90 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 09:07:36 +0000 Subject: [PATCH 047/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 8e2c610..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1aa5e9f..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index c9951d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 558fdd5..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 87f463d3d7f29bac0dabad3d963fe6c0182dc42a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 09:08:29 +0000 Subject: [PATCH 048/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 12410 insertions(+), 9290 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index f067ffc..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-06-01T02:30:52.650Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..8e2c610 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1aa5e9f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 538ae0a..5a13cb4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.7", - "@stdlib/assert-is-arraybuffer": "^0.0.8", - "@stdlib/assert-is-boolean": "^0.0.8", - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/assert-is-int8array": "^0.0.8", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/math-base-special-round": "^0.0.7", - "@stdlib/random-base-randi": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/symbol-iterator": "^0.0.7", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..83c45ad --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..181686a --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From e751139ca7fdfd067330c7db259877ef14d396b3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 03:53:48 +0000 Subject: [PATCH 049/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 48552bd..538ae0a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8" + "@stdlib/assert-has-int8array-support": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.7", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 49b5dca5c26b1996659ff520a6a5ea7b06a54dcc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 09:02:22 +0000 Subject: [PATCH 050/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 8e2c610..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1aa5e9f..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 83c45ad..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 181686a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ea88691f481c7e556bb1943dad2543db5e3d0193 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 09:03:21 +0000 Subject: [PATCH 051/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 12410 insertions(+), 9290 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 41f8a51..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-07-01T02:33:21.259Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..8e2c610 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1aa5e9f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 538ae0a..5a13cb4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.7", - "@stdlib/assert-is-arraybuffer": "^0.0.8", - "@stdlib/assert-is-boolean": "^0.0.8", - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/assert-is-int8array": "^0.0.8", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/math-base-special-round": "^0.0.7", - "@stdlib/random-base-randi": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/symbol-iterator": "^0.0.7", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..d09cc32 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..464a4c7 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 18488bf156c03c6518b9ad9c6dc72639b326e5d7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 04:08:12 +0000 Subject: [PATCH 052/145] Transform error messages --- lib/polyfill.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..44ea85c 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // TODO: write polyfill // MAIN // @@ -28,7 +30,7 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format( '00V00' ) ); } diff --git a/package.json b/package.json index 48552bd..538ae0a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8" + "@stdlib/assert-has-int8array-support": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.7", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 9dd57475f0f462101f86e9e144c2273b73646900 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 10:06:09 +0000 Subject: [PATCH 053/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 8e2c610..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1aa5e9f..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index d09cc32..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 464a4c7..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a4b4b4f8a4dea970004a52e2e70a774748a4506a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 10:07:11 +0000 Subject: [PATCH 054/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 39 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 95 files changed, 12410 insertions(+), 9290 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 1ce2afe..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-08-01T02:44:02.676Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 334eb59..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..8e2c610 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index c4f785b..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 2.0 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1aa5e9f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 44ea85c..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format( '00V00' ) ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 538ae0a..5a13cb4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.7", - "@stdlib/assert-is-arraybuffer": "^0.0.8", - "@stdlib/assert-is-boolean": "^0.0.8", - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/assert-is-int8array": "^0.0.8", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/math-base-special-round": "^0.0.7", - "@stdlib/random-base-randi": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/symbol-iterator": "^0.0.7", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e692bdd --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..76d8d53 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 82a7d8733f912372117c256888f1a2f79c76ddb1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 19 Aug 2023 01:44:03 +0000 Subject: [PATCH 055/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..629835e 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100,Cw') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 48552bd..538ae0a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8" + "@stdlib/assert-has-int8array-support": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.0.7", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b4801ff90de93c72b09308274710fb5bb63719d8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 19 Aug 2023 01:52:55 +0000 Subject: [PATCH 056/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 8e2c610..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1aa5e9f..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format( '00V00' ) );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAQ,SAC1B,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e692bdd..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 76d8d53..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 39be0d9332b84d31fe2671dbf9f2cae3a2f25fca Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 19 Aug 2023 01:53:55 +0000 Subject: [PATCH 057/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 97 files changed, 12410 insertions(+), 9302 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1411,10 +1419,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1533,23 +1551,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..38ab285 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EbkBerC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..4f7f8e7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EbkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 629835e..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100,Cw') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 538ae0a..5a13cb4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.6", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.0.7", - "@stdlib/assert-is-arraybuffer": "^0.0.8", - "@stdlib/assert-is-boolean": "^0.0.8", - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/assert-is-int8array": "^0.0.8", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/math-base-special-round": "^0.0.7", - "@stdlib/random-base-randi": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/symbol-iterator": "^0.0.7", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..87f9675 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..f8ad072 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From e7872099944ff613f4e4d03ff27acf3bd3363663 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 02:51:26 +0000 Subject: [PATCH 058/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..629835e 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100,Cw') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 8b930a4..b9d8275 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.0" + "@stdlib/assert-has-int8array-support": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.0" }, "devDependencies": { "@stdlib/assert-has-property": "^0.1.0", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8eea77c4c3b2abd0f41b1f3ce41822540ca82679 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 05:01:33 +0000 Subject: [PATCH 059/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 38ab285..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EbkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 4f7f8e7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol.toStringTag:"",f=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,f,l,i,y;if(null==t)return o.call(t);f=t[e],y=e,n=null!=(i=t)&&r.call(i,y);try{t[e]=void 0}catch(n){return o.call(t)}return l=o.call(t),n?t[e]=f:delete t[e],l}:function(t){return o.call(t)},l="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,y="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?y:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './native_class.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","toStrTag","toStringTag","nativeClass$1","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","nativeClass","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA+B,mBAAXP,OAA0BA,OAAOQ,YAAc,GCsCvEC,ENlBUV,GAAqC,iBAAvBC,OAAOQ,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EHHgBC,EAAOC,EGK3B,GAAKL,QACJ,OAAOT,EAAMe,KAAMN,GAEpBE,EAAMF,EAAGF,GHRkBO,EGSJP,EAAvBG,EHPCG,OAFmBA,EGSAJ,IHFbL,EAAIW,KAAMF,EAAOC,GGKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOhB,EAAMe,KAAMN,EACnB,CAQD,OAPAG,EAAMZ,EAAMe,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOT,EAAMe,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDrB,EAA8B,mBAAdqB,UAA6BA,eAAY,SVuB5DrB,EWND,WACC,IAAIuB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBM,EAAaX,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CXlBKK,GACGC,EaZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EbkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 87f9675..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index f8ad072..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7411696a4aa0c215481eda3753e713f904c1d991 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 05:02:31 +0000 Subject: [PATCH 060/145] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 98 files changed, 12410 insertions(+), 9337 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 9f9974a..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index e05cfd9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4c6e8fe --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1732e8c --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 629835e..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100,Cw') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index b9d8275..5d60fe9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.0" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.0", - "@stdlib/assert-is-arraybuffer": "^0.1.0", - "@stdlib/assert-is-boolean": "^0.1.0", - "@stdlib/assert-is-function": "^0.1.0", - "@stdlib/assert-is-int8array": "^0.1.0", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/math-base-special-round": "^0.1.0", - "@stdlib/random-base-randi": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/symbol-iterator": "^0.1.0", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5eb7d0 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..78fe777 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From b636b3360891e78b6ea5e489ed9278a4e7bc563e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 06:04:35 +0000 Subject: [PATCH 061/145] Update README.md for UMD bundle v0.1.0 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e755131..6f11ecb 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@umd/browser.js' ) +Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@v0.1.0-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var Int8Array = require( 'path/to/vendor/umd/array-int8/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1436,7 @@ var bool = it.next().done; - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1441,7 @@ var bool = it.next().done; - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 78fe777..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7ef4973241b59dfe7fec1d936c9c1056fd32d132 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Oct 2023 05:23:53 +0000 Subject: [PATCH 065/145] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 80 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 100 files changed, 12410 insertions(+), 9476 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 02ef4fb..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T02:01:51.501Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4123808..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4c6e8fe --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1732e8c --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 629835e..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100,Cw') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 12370cb..5d60fe9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.0" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.0", - "@stdlib/assert-is-arraybuffer": "^0.1.0", - "@stdlib/assert-is-boolean": "^0.1.0", - "@stdlib/assert-is-function": "^0.1.0", - "@stdlib/assert-is-int8array": "^0.1.0", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.0", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.0", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..2c85983 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..0aaac51 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 7dc0e94..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../../dist/polyfill.js' ); -var ctor = require( './../../dist' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../dist', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../dist', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 0e7d08642410f9309dc85c6cd6ccb442eaefafef Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 07:16:55 +0000 Subject: [PATCH 066/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..629835e 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100,Cw') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 3bec288..0b058f9 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.0" + "@stdlib/assert-has-int8array-support": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.1.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b5ef25986d94ff3b2ab61d0687255a1f8ce3e537 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 07:06:12 +0000 Subject: [PATCH 067/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4c6e8fe..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1732e8c..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 2c85983..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 0aaac51..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c79a9f9dd9ea2061712e42641867f66297f74104 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 07:09:18 +0000 Subject: [PATCH 068/145] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 99 files changed, 12410 insertions(+), 9428 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4123808..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4c6e8fe --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1732e8c --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 629835e..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100,Cw') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 0b058f9..5d60fe9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.1", - "@stdlib/assert-is-arraybuffer": "^0.1.1", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.1.1", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.0", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..991095f --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..a4ce8ab --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 08624f5010315bdfb4a67511d894b4b5f6c51878 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Oct 2023 20:31:48 +0000 Subject: [PATCH 069/145] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e38d394..2e71867 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1" + "@stdlib/assert-has-int8array-support": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.1.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 9b60e3ac3f1266c1a87d5e65f6c92ae77f7cf31a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 10 Oct 2023 01:03:52 +0000 Subject: [PATCH 070/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4c6e8fe..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1732e8c..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 991095f..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index a4ce8ab..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From cafa7787c264ba3d6db64153360ad2a18dbbcd14 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 10 Oct 2023 01:07:50 +0000 Subject: [PATCH 071/145] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 37 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 99 files changed, 12410 insertions(+), 9427 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4123808..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..216eb1f --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); +//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map new file mode 100644 index 0000000..bc69b67 --- /dev/null +++ b/browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b026a67 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); +//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map new file mode 100644 index 0000000..87e5bd5 --- /dev/null +++ b/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index cd3f2fb..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( 'not implemented' ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 2e71867..396e5ca 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.1", - "@stdlib/assert-is-arraybuffer": "^0.1.1", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.1.1", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..ea5ddda --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..44a4dd6 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From f3fc190e0496f0fe4ae0fc2dfb803d79dfeaa743 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 10 Oct 2023 03:54:14 +0000 Subject: [PATCH 072/145] Update README.md for UMD bundle v0.1.1 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1e78de6..826a34d 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@umd/browser.js' ) +Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@v0.1.1-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var Int8Array = require( 'path/to/vendor/umd/array-int8/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1436,7 @@ var bool = it.next().done; - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1441,7 @@ var bool = it.next().done; - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 44a4dd6..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6418223130210c899f1294410d322e849ee4ffe8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 05:44:01 +0000 Subject: [PATCH 076/145] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 37 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 100 files changed, 12410 insertions(+), 9437 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 06016d4..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-11-01T02:04:59.718Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4123808..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4c6e8fe --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 000d037..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// tslint:disable: no-construct -// tslint:disable: no-unused-expression - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1732e8c --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 629835e..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100,Cw') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 2e71867..396e5ca 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.1", - "@stdlib/assert-is-arraybuffer": "^0.1.1", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.1.1", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb8783f --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..bbde168 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 3338111cc5bbfc8c148822bd6e43c6c8b791c423 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 21:27:27 +0000 Subject: [PATCH 077/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..629835e 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100,Cw') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 8a710e2..580b53c 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1" + "@stdlib/assert-has-int8array-support": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.1.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From bd12b5cf201f8285ff2d9d2b57eac4164809914f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 21:38:12 +0000 Subject: [PATCH 078/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4c6e8fe..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1732e8c..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index bb8783f..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index bbde168..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ece2fb8fb75edd22f2721724f271e49c9bfb589c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 21:42:16 +0000 Subject: [PATCH 079/145] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 99 files changed, 12410 insertions(+), 9435 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4123808..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4c6e8fe --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1732e8c --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 629835e..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100,Cw') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 580b53c..396e5ca 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.1", - "@stdlib/assert-is-arraybuffer": "^0.1.1", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.1.1", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/bench": "^0.2.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e3f04c9 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..ecc8c06 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 93d4c0a4fc33660e503df16ff91f7810b996fddf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 24 Nov 2023 21:00:27 +0000 Subject: [PATCH 080/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..629835e 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100,Cw') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 1832a93..8a5d77b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1" + "@stdlib/assert-has-int8array-support": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.1.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1d041578c434dfcfee5b90e0eb90e10358e62a90 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 24 Nov 2023 21:02:34 +0000 Subject: [PATCH 081/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4c6e8fe..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1732e8c..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e3f04c9..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index ecc8c06..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7bd89cc3fcb496767ef84d30d1d5f489f89ad080 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 24 Nov 2023 21:05:18 +0000 Subject: [PATCH 082/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 99 files changed, 12410 insertions(+), 9430 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4123808..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4c6e8fe --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1732e8c --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 629835e..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100,Cw') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a5d77b..396e5ca 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.1", - "@stdlib/assert-is-arraybuffer": "^0.1.1", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.1.1", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/bench": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..698c316 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..bb7aa1b --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 50aab80620cbc3ee8f686b79b57829b9e9252e3b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 04:35:05 +0000 Subject: [PATCH 083/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..629835e 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100,Cw') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 1832a93..8a5d77b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1" + "@stdlib/assert-has-int8array-support": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.1.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1bd309a3741351bae087077cd55e94940aec8ca5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 20:34:37 +0000 Subject: [PATCH 084/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4c6e8fe..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1732e8c..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 698c316..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index bb7aa1b..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 0b05c2694d18be3be43f5e1ee050355c1033470d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 20:37:15 +0000 Subject: [PATCH 085/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 100 files changed, 12410 insertions(+), 9431 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index e652f72..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T02:12:50.077Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4123808..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 60156d2..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 77a880b..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index a4dda02..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index b830a69..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 492d705..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index ee183fa..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index da6d595..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index ef2a425..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 9387147..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index abfeb2b..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 470dd8d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 4e7119c..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 7b6e032..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 5eeb376..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index c88177e..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 906743c..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index 52fe0cd..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 9a20515..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 7416820..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index d638435..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index c952322..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 2f0ddb4..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index de1ec3c..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5057627..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dfdeb1d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 00b9448..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 11fac2b..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 322b7ec..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 98a2713..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 9629833..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 58dd2de..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 6e89d3f..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 6dc489b..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index d134ef5..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 5c5d499..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 910f158..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 113a3c3..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7fdb467..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 0072330..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 668ad69..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index d19ed0c..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 46fd73c..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index e1dee15..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 42e85e0..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 63ddf66..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index c5dff74..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 0a536eb..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 504a886..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index 510a369..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 2b657f1..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index ab4aebc..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index cedbcc1..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 1849e01..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4c6e8fe --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1732e8c --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index 629835e..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100,Cw') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a5d77b..396e5ca 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.1", - "@stdlib/assert-is-arraybuffer": "^0.1.1", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.1.1", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/bench": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..10fdb82 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..cae1574 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From f2603e625f9f6257c09906ac72750ca95fca2e0a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 03:10:50 +0000 Subject: [PATCH 086/145] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 578dc17..4aa060d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1" + "@stdlib/assert-has-int8array-support": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.1.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d1ccd8413f28357ebdf58d85f493fea2119a04f2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 08:07:36 +0000 Subject: [PATCH 087/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4c6e8fe..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 1732e8c..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100,Cw') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,YACzB,EdkBerC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 10fdb82..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index cae1574..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 3f2c69458795db7c75cf32e3c157b2c89bd5e98c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 08:07:58 +0000 Subject: [PATCH 088/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 37 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 12410 insertions(+), 9436 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 8174c10..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T01:56:25.774Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 30656c4..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c92f5c4..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 3934a24..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1422,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1544,23 +1562,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index de477b5..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..5a11486 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); +//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map new file mode 100644 index 0000000..bc69b67 --- /dev/null +++ b/browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..28cf074 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); +//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map new file mode 100644 index 0000000..87e5bd5 --- /dev/null +++ b/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index cd3f2fb..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( 'not implemented' ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 4aa060d..396e5ca 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.1", - "@stdlib/assert-is-arraybuffer": "^0.1.1", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.1.1", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..4f05997 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..520a5ba --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 1570141ad3aa3536c20b5e74d842b93982b3e883 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 03:20:02 +0000 Subject: [PATCH 089/145] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 578dc17..4aa060d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1" + "@stdlib/assert-has-int8array-support": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.1.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 48dd709f497d069e5f6aa836a759add12524859a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 07:21:32 +0000 Subject: [PATCH 090/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 5a11486..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); -//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map deleted file mode 100644 index bc69b67..0000000 --- a/browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 28cf074..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); -//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map deleted file mode 100644 index 87e5bd5..0000000 --- a/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 4f05997..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 520a5ba..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 9544bbe094dc2537cda093d1bbb13534a42d8e22 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 07:21:50 +0000 Subject: [PATCH 091/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 37 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 12409 insertions(+), 9440 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 0583460..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T02:15:45.443Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 30656c4..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c92f5c4..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 3934a24..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..5a11486 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); +//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map new file mode 100644 index 0000000..bc69b67 --- /dev/null +++ b/browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..28cf074 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); +//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map new file mode 100644 index 0000000..87e5bd5 --- /dev/null +++ b/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index cd3f2fb..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( 'not implemented' ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 4aa060d..396e5ca 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.1.1", - "@stdlib/assert-is-arraybuffer": "^0.1.1", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.1.1", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.1.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..9d17ed7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..fd8a7e4 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 05f3d073ed581b1dc35671fa37f0de055204ecc0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 06:44:24 +0000 Subject: [PATCH 092/145] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1dddcc9..89199ad 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.0" + "@stdlib/assert-has-int8array-support": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.0", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 949c7196aefd4d251683161ce257158e59e34579 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 13:18:51 +0000 Subject: [PATCH 093/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 5a11486..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); -//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map deleted file mode 100644 index bc69b67..0000000 --- a/browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"browser.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 28cf074..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); -//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map deleted file mode 100644 index 87e5bd5..0000000 --- a/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 9d17ed7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index fd8a7e4..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 64be594489a595a498cf17718e141df79c2e8948 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 13:19:17 +0000 Subject: [PATCH 094/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 --- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 37 - package.json | 65 +- stats_browser.html | 6177 +++++++++++++++++ stats_node.html | 6177 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 - test/test.js | 80 - test/test.polyfill.js | 44 - 100 files changed, 12409 insertions(+), 9443 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 670b71c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..5a11486 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); +//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map new file mode 100644 index 0000000..247bae7 --- /dev/null +++ b/browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.js","sources":["../node_modules/@stdlib/utils-native-class/node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/utils-native-class/node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..28cf074 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,e="function"==typeof Symbol?Symbol:void 0,r="function"==typeof e?e.toStringTag:"",f=t&&"symbol"==typeof Symbol.toStringTag?function(t){var e,f,y,i,l;if(null==t)return n.call(t);f=t[r],l=r,e=null!=(i=t)&&o.call(i,l);try{t[r]=void 0}catch(o){return n.call(t)}return y=n.call(t),e?t[r]=f:delete t[r],y}:function(t){return n.call(t)},y="function"==typeof Int8Array,i="function"==typeof Int8Array?Int8Array:null,l="function"==typeof Int8Array?Int8Array:void 0;return function(){var t,n,o;if("function"!=typeof i)return!1;try{n=new i([1,3.14,-3.14,128]),o=n,t=(y&&o instanceof Int8Array||"[object Int8Array]"===f(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?l:function(){throw new Error("not implemented")}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Int8Array=n(); +//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map new file mode 100644 index 0000000..821667f --- /dev/null +++ b/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../node_modules/@stdlib/utils-native-class/node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/utils-native-class/node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../lib/main.js","../node_modules/@stdlib/assert-has-int8array-support/lib/main.js","../node_modules/@stdlib/constants-int8-min/lib/index.js","../lib/index.js","../lib/polyfill.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n"],"names":["FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","ctor","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error"],"mappings":";yCA2BA,IAAIA,ECMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,ENlBUX,GAAqC,iBAAvBC,OAAOS,YOQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CAGnB,CAFC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDE,EAA8B,mBAAdF,UAA6BA,eAAY,SCiB7D,WACC,IAAIG,EACAC,EHKiBT,EGHrB,GAAgC,mBAApBU,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBX,EGINS,EADdD,GHDEJ,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbS,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAIN,CAFC,MAAQN,GACTK,GAAO,CACP,CACD,OAAOA,CACR,CElBKI,GACGC,ECdR,WACC,MAAM,IAAIC,MAAO,kBAClB"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index cd3f2fb..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( 'not implemented' ); -} - - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 89199ad..79e2a23 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.0", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.2.0" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.0", - "@stdlib/assert-is-arraybuffer": "^0.2.0", - "@stdlib/assert-is-boolean": "^0.1.1", - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/assert-is-int8array": "^0.2.0", - "@stdlib/assert-is-nonnegative-integer": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/math-base-special-round": "^0.1.1", - "@stdlib/random-base-randi": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/symbol-iterator": "^0.2.0", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e53ef4b --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..748d4b5 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 76350e5fe9c93a1bc5522590bacc0503ddcaf5c3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 17:15:18 +0000 Subject: [PATCH 095/145] Update README.md for UMD bundle v0.2.0 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2dde02d..6ea7b7b 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@umd/browser.js' ) +Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@v0.2.0-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var Int8Array = require( 'path/to/vendor/umd/array-int8/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1436,7 @@ var bool = it.next().done; - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1441,7 @@ var bool = it.next().done; - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 748d4b5..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e0934ce08d1ab1dbbf229cfce461c3f16a598d0d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 22 Feb 2024 22:31:13 +0000 Subject: [PATCH 099/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 249 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 100 files changed, 9739 insertions(+), 9438 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index a4ad46d..419b185 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.1", - "@stdlib/assert-is-arraybuffer": "^0.2.1", - "@stdlib/assert-is-boolean": "^0.2.1", - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/assert-is-int8array": "^0.2.1", - "@stdlib/assert-is-nonnegative-integer": "^0.2.0", - "@stdlib/math-base-special-pow": "^0.2.0", - "@stdlib/math-base-special-round": "^0.2.1", - "@stdlib/random-base-randi": "^0.2.0", - "@stdlib/random-base-randu": "^0.2.0", - "@stdlib/symbol-iterator": "^0.2.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..46c9167 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..e8d3858 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 5816e6afaad8177e8a78f110a84326af01b9d42d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 22 Feb 2024 22:45:38 +0000 Subject: [PATCH 100/145] Update README.md for UMD bundle v0.2.1 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b8d5c9f..091bae1 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@umd/browser.js' ) +Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@v0.2.1-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var Int8Array = require( 'path/to/vendor/umd/array-int8/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1436,7 @@ var bool = it.next().done; - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1441,7 @@ var bool = it.next().done; - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index e8d3858..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1f56f9260eff1493bf4674a5cf5db99b6371dcd7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 05:51:18 +0000 Subject: [PATCH 104/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 249 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 9739 insertions(+), 9440 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 867c9b4..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T02:12:25.834Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 9371a2e..419b185 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.1", - "@stdlib/assert-is-arraybuffer": "^0.2.1", - "@stdlib/assert-is-boolean": "^0.2.1", - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/assert-is-int8array": "^0.2.1", - "@stdlib/assert-is-nonnegative-integer": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/math-base-special-round": "^0.2.1", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 8106e3345373c56f7da248e1c34557b95d1b0ddc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 02:46:04 +0000 Subject: [PATCH 105/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index d9efda7..9371a2e 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.1" + "@stdlib/assert-has-int8array-support": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 60c4fbd71afe818fb6e9e76d4010e7503410a39e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 06:13:49 +0000 Subject: [PATCH 106/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 368a6585f45c3be0e2e8d839eb02e109e91628d0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 06:14:04 +0000 Subject: [PATCH 107/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 249 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 9739 insertions(+), 9443 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 2e80ab5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T01:52:08.030Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 9371a2e..419b185 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.1", - "@stdlib/assert-is-arraybuffer": "^0.2.1", - "@stdlib/assert-is-boolean": "^0.2.1", - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/assert-is-int8array": "^0.2.1", - "@stdlib/assert-is-nonnegative-integer": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/math-base-special-round": "^0.2.1", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 58c5d45de4c38666f922df944822a6433d37b9fa Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 11 Apr 2024 22:49:50 +0000 Subject: [PATCH 108/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index d9efda7..9371a2e 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.1" + "@stdlib/assert-has-int8array-support": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 4cfb6a901c7b30f745f5928f2592c5eb893abc93 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 02:32:41 +0000 Subject: [PATCH 109/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a013a03cba1347ee03dc9b70d4f9ae074b1874f9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 02:33:01 +0000 Subject: [PATCH 110/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 249 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 134 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 100 files changed, 9739 insertions(+), 9444 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index a71d10a..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ); - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - [ 1, 2, 3 ] - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 1 - > arr2[ 1 ] - 2 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 9371a2e..419b185 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.1", - "@stdlib/assert-is-arraybuffer": "^0.2.1", - "@stdlib/assert-is-boolean": "^0.2.1", - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/assert-is-int8array": "^0.2.1", - "@stdlib/assert-is-nonnegative-integer": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/math-base-special-round": "^0.2.1", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From f6f386710bce1f66cdbaa15e64da6d79fb67a9f1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jun 2024 05:49:48 +0000 Subject: [PATCH 111/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index d9efda7..9371a2e 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.1" + "@stdlib/assert-has-int8array-support": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.1", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 4ac39341d4c707250f59d61dad0dc9e91a311758 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jun 2024 05:50:41 +0000 Subject: [PATCH 112/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 14e585399c9d69bec838fbd68a902aefa7fd20f4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jun 2024 05:50:56 +0000 Subject: [PATCH 113/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 248 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 100 files changed, 9739 insertions(+), 9451 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f92a6c5..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 9371a2e..419b185 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.1", - "@stdlib/assert-is-arraybuffer": "^0.2.1", - "@stdlib/assert-is-boolean": "^0.2.1", - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/assert-is-int8array": "^0.2.1", - "@stdlib/assert-is-nonnegative-integer": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/math-base-special-round": "^0.2.1", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.1", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From eb745cd290a588293885cd3c05f4e86113c42ad8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Jul 2024 14:13:55 +0000 Subject: [PATCH 114/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index f4ce6f4..9ab050d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 87a0c0c7ccf2c1c88fef582eeba5beb274cfda31 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Jul 2024 14:35:47 +0000 Subject: [PATCH 115/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5c577ea6adc6f2999daf1d6c0ca0e048cf441a44 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Jul 2024 14:36:02 +0000 Subject: [PATCH 116/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 211 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 100 files changed, 9739 insertions(+), 9661 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 9ab050d..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/math-base-special-round": "^0.2.1", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 3b5b09943c181845f8168dc2b0bc25604c2a1f3d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Jul 2024 14:45:32 +0000 Subject: [PATCH 117/145] Update README.md for UMD bundle v0.2.2 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6dd3e5e..86eeac2 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@umd/browser.js' ) +Int8Array = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-int8@v0.2.2-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var Int8Array = require( 'path/to/vendor/umd/array-int8/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1436,7 @@ var bool = it.next().done; - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -1436,7 +1441,7 @@ var bool = it.next().done; - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e71af1f54a768577163b1f03208dc375b697cb57 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 06:15:27 +0000 Subject: [PATCH 121/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 148 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 9739 insertions(+), 9601 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 6b78b18..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T02:16:25.222Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From b225a74e6fee5ba6494c1b4f7a661c8b90921910 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 17:50:59 +0000 Subject: [PATCH 122/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 84bb928..8a41d94 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8c4d80b8b43f872dc5d41b57383c5517e2532a47 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 19:53:09 +0000 Subject: [PATCH 123/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 0ac531fa459be88f982ce071b8d82a2ae58b481b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 19:53:24 +0000 Subject: [PATCH 124/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 211 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 9739 insertions(+), 9664 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 18e396c..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-03T17:12:29.397Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 046f446c8fbc49b0585a9fab202ac60fc1ba8b43 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 03:19:43 +0000 Subject: [PATCH 125/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 84bb928..8a41d94 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 5bd603aca1e3dbd5d34dff16c3ce2b512503b366 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 06:03:23 +0000 Subject: [PATCH 126/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From efcd9a15cd87e0465bba72891f250038934eb4f3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 06:03:39 +0000 Subject: [PATCH 127/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 210 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 9739 insertions(+), 9663 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 6d479f1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T02:25:19.316Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From b362f950757bcff0ed1631371686362d6fc1d447 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 03:24:46 +0000 Subject: [PATCH 128/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 84bb928..8a41d94 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 455327402862c6d2895d8f6f418a9b6c75243fd7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 06:04:31 +0000 Subject: [PATCH 129/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a685c2ea45f1155d49836771d234e7016164d7d4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 06:04:44 +0000 Subject: [PATCH 130/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 210 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 9739 insertions(+), 9663 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 8486f63..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T02:34:02.523Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 1a32a115e2495a138f50827bafb116e71f7ed7b6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 03:23:29 +0000 Subject: [PATCH 131/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 84bb928..8a41d94 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 71b71a84e3d18d36d622c4be683410d567012e9e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 05:49:43 +0000 Subject: [PATCH 132/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8b631e3e9bc6a212d7d8d0171e97d481d5c96c97 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 05:49:58 +0000 Subject: [PATCH 133/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 210 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 9739 insertions(+), 9663 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 47c9091..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T02:33:47.617Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 4a9343d6bdb82d3ec58a951bcb1c6835fd8fe88b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 03:29:55 +0000 Subject: [PATCH 134/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 84bb928..8a41d94 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 618b6a70bd5793d1cd4f7c319fe59c2caeafe66c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 06:13:29 +0000 Subject: [PATCH 135/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f4cb8343055725674886afce4f136d49163750b4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 06:14:05 +0000 Subject: [PATCH 136/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 210 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 102 files changed, 9739 insertions(+), 9768 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index a3dbe99..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T02:40:14.901Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From 99335157a02bd9ea0c9321b2324aa45a0b202c78 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 02:09:54 +0000 Subject: [PATCH 137/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 84bb928..8a41d94 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b4ad3c843fdee2cda720e0fe93ea576b609a3d3d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 02:37:15 +0000 Subject: [PATCH 138/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1d5615490417307301c63e96cd5faa9708909a19 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 02:37:32 +0000 Subject: [PATCH 139/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 210 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 102 files changed, 9739 insertions(+), 9768 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0779e8a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index c111d85..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-30T02:00:46.995Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..4941631 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..506c0f7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From b90bf0067862cc9d71ca2e02b805ad79d15e17d9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 4 Jan 2025 21:20:06 +0000 Subject: [PATCH 140/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 84bb928..8a41d94 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 75b4d281a6620f70662eaa7bd1011353a1ed39f9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 4 Jan 2025 21:22:44 +0000 Subject: [PATCH 141/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 4941631..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 506c0f7..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From db6552259fa8bdb3c22b42eb491a0de12f4ad8d0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 4 Jan 2025 21:23:02 +0000 Subject: [PATCH 142/145] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 244 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 101 files changed, 9739 insertions(+), 9801 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0779e8a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 36166e1..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..fee7627 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9a40bbf --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests From e17960cd739d0011b57d63045a3fe2d2531b5943 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 17 Mar 2025 01:16:33 +0000 Subject: [PATCH 143/145] Transform error messages --- lib/polyfill.js | 5 +++-- package.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index cd3f2fb..d2cc855 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // TODO: write polyfill // MAIN // @@ -28,10 +30,9 @@ * @throws {Error} not implemented */ function polyfill() { - throw new Error( 'not implemented' ); + throw new Error( format('01100') ); } - // EXPORTS // module.exports = polyfill; diff --git a/package.json b/package.json index 84bb928..8a41d94 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2" + "@stdlib/assert-has-int8array-support": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-has-property": "^0.2.2", @@ -94,4 +95,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 90c7167bee6843cff03555af62f4e12461d2e925 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 17 Mar 2025 01:28:28 +0000 Subject: [PATCH 144/145] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index fee7627..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9a40bbf..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5a89df8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 84f7bb1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f0ef16d5a66cad1027e6d8f54048ce243a26826a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 17 Mar 2025 01:28:43 +0000 Subject: [PATCH 145/145] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 244 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 74 +- SECURITY.md | 5 - benchmark/benchmark.copy_within.js | 52 - benchmark/benchmark.copy_within.length.js | 95 - benchmark/benchmark.data.js | 75 - benchmark/benchmark.entries.js | 50 - benchmark/benchmark.every.js | 81 - benchmark/benchmark.every.length.js | 105 - benchmark/benchmark.fill.js | 51 - benchmark/benchmark.fill.length.js | 94 - benchmark/benchmark.filter.js | 81 - benchmark/benchmark.filter.length.js | 105 - benchmark/benchmark.find.js | 82 - benchmark/benchmark.find.length.js | 105 - benchmark/benchmark.find_index.js | 82 - benchmark/benchmark.find_index.length.js | 104 - benchmark/benchmark.for_each.js | 88 - benchmark/benchmark.for_each.length.js | 106 - benchmark/benchmark.from.js | 237 - benchmark/benchmark.includes.js | 53 - benchmark/benchmark.includes.length.js | 96 - benchmark/benchmark.index_of.js | 53 - benchmark/benchmark.index_of.length.js | 95 - benchmark/benchmark.join.js | 51 - benchmark/benchmark.join.length.js | 94 - benchmark/benchmark.js | 47 - benchmark/benchmark.keys.js | 50 - benchmark/benchmark.last_index_of.js | 53 - benchmark/benchmark.last_index_of.length.js | 95 - benchmark/benchmark.length.js | 93 - benchmark/benchmark.map.js | 81 - benchmark/benchmark.map.length.js | 105 - benchmark/benchmark.of.js | 48 - benchmark/benchmark.properties.js | 145 - benchmark/benchmark.reduce.js | 80 - benchmark/benchmark.reduce.length.js | 105 - benchmark/benchmark.reduce_right.js | 80 - benchmark/benchmark.reduce_right.length.js | 105 - benchmark/benchmark.reverse.js | 52 - benchmark/benchmark.reverse.length.js | 95 - benchmark/benchmark.set.js | 94 - benchmark/benchmark.set.length.js | 114 - benchmark/benchmark.slice.js | 52 - benchmark/benchmark.slice.length.js | 95 - benchmark/benchmark.some.js | 81 - benchmark/benchmark.some.length.js | 105 - benchmark/benchmark.sort.js | 53 - benchmark/benchmark.sort.length.js | 105 - benchmark/benchmark.subarray.js | 51 - benchmark/benchmark.subarray.length.js | 94 - benchmark/benchmark.to_locale_string.js | 51 - .../benchmark.to_locale_string.length.js | 94 - benchmark/benchmark.to_string.js | 51 - benchmark/benchmark.to_string.length.js | 94 - benchmark/benchmark.values.js | 50 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 953 ---- docs/types/index.d.ts | 26 - docs/types/test.ts | 36 - examples/index.js | 32 - index.js | 3 + index.js.map | 1 + lib/index.js | 52 - lib/main.js | 28 - lib/polyfill.js | 38 - package.json | 65 +- stats_browser.html | 4842 +++++++++++++++++ stats_node.html | 4842 +++++++++++++++++ test/dist/test.js | 33 - test/test.copy_within.js | 320 -- test/test.js | 80 - test/test.polyfill.js | 44 - 102 files changed, 9739 insertions(+), 9805 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.copy_within.js delete mode 100644 benchmark/benchmark.copy_within.length.js delete mode 100644 benchmark/benchmark.data.js delete mode 100644 benchmark/benchmark.entries.js delete mode 100644 benchmark/benchmark.every.js delete mode 100644 benchmark/benchmark.every.length.js delete mode 100644 benchmark/benchmark.fill.js delete mode 100644 benchmark/benchmark.fill.length.js delete mode 100644 benchmark/benchmark.filter.js delete mode 100644 benchmark/benchmark.filter.length.js delete mode 100644 benchmark/benchmark.find.js delete mode 100644 benchmark/benchmark.find.length.js delete mode 100644 benchmark/benchmark.find_index.js delete mode 100644 benchmark/benchmark.find_index.length.js delete mode 100644 benchmark/benchmark.for_each.js delete mode 100644 benchmark/benchmark.for_each.length.js delete mode 100644 benchmark/benchmark.from.js delete mode 100644 benchmark/benchmark.includes.js delete mode 100644 benchmark/benchmark.includes.length.js delete mode 100644 benchmark/benchmark.index_of.js delete mode 100644 benchmark/benchmark.index_of.length.js delete mode 100644 benchmark/benchmark.join.js delete mode 100644 benchmark/benchmark.join.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.keys.js delete mode 100644 benchmark/benchmark.last_index_of.js delete mode 100644 benchmark/benchmark.last_index_of.length.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 benchmark/benchmark.map.js delete mode 100644 benchmark/benchmark.map.length.js delete mode 100644 benchmark/benchmark.of.js delete mode 100644 benchmark/benchmark.properties.js delete mode 100644 benchmark/benchmark.reduce.js delete mode 100644 benchmark/benchmark.reduce.length.js delete mode 100644 benchmark/benchmark.reduce_right.js delete mode 100644 benchmark/benchmark.reduce_right.length.js delete mode 100644 benchmark/benchmark.reverse.js delete mode 100644 benchmark/benchmark.reverse.length.js delete mode 100644 benchmark/benchmark.set.js delete mode 100644 benchmark/benchmark.set.length.js delete mode 100644 benchmark/benchmark.slice.js delete mode 100644 benchmark/benchmark.slice.length.js delete mode 100644 benchmark/benchmark.some.js delete mode 100644 benchmark/benchmark.some.length.js delete mode 100644 benchmark/benchmark.sort.js delete mode 100644 benchmark/benchmark.sort.length.js delete mode 100644 benchmark/benchmark.subarray.js delete mode 100644 benchmark/benchmark.subarray.length.js delete mode 100644 benchmark/benchmark.to_locale_string.js delete mode 100644 benchmark/benchmark.to_locale_string.length.js delete mode 100644 benchmark/benchmark.to_string.js delete mode 100644 benchmark/benchmark.to_string.length.js delete mode 100644 benchmark/benchmark.values.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/polyfill.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.copy_within.js delete mode 100644 test/test.js delete mode 100644 test/test.polyfill.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 2d37599..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-03-17T01:10:15.982Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 7ec6718..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 05e9f6b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b05baed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '6 6 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var Int8Array = require( '@stdlib/array-int8' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### Int8Array() @@ -1424,10 +1430,15 @@ var bool = it.next().done; -```javascript -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( '@stdlib/array-int8' ); +```html + + + + + + + + + ```
@@ -1549,23 +1565,23 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd -[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32 +[@stdlib/array/float32]: https://github.com/stdlib-js/array-float32/tree/umd -[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64/tree/umd -[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16 +[@stdlib/array/int16]: https://github.com/stdlib-js/array-int16/tree/umd -[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32 +[@stdlib/array/int32]: https://github.com/stdlib-js/array-int32/tree/umd -[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16 +[@stdlib/array/uint16]: https://github.com/stdlib-js/array-uint16/tree/umd -[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32 +[@stdlib/array/uint32]: https://github.com/stdlib-js/array-uint32/tree/umd -[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8 +[@stdlib/array/uint8]: https://github.com/stdlib-js/array-uint8/tree/umd -[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c +[@stdlib/array/uint8c]: https://github.com/stdlib-js/array-uint8c/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 5899874..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':copyWithin', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 2f5e84a..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr[ 0 ] = v; - arr = arr.copyWithin( 1, 0 ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':copyWithin:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.data.js b/benchmark/benchmark.data.js deleted file mode 100644 index 413ab6c..0000000 --- a/benchmark/benchmark.data.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get,index', function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr[ i%N ]; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,index', function benchmark( b ) { - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%N ] = i; - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] || arr[ 1 ] !== arr[ 1 ] ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index bfc1d62..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':entries', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index 83d9b61..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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; - } -}); - -bench( pkg+'::this_context:every', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - 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 deleted file mode 100644 index 0e51f54..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index cc79c4b..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':fill', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 76b46bb..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = i % 128; - arr = arr.fill( v ); - if ( arr[ 0 ] !== v ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( arr[ 0 ] !== arr[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - 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+':fill:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index e98bb20..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); - -bench( pkg+'::this_context:filter', function benchmark( b ) { - var arr; - var out; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v >= 0; - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index 8ab46a7..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':filter:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index b09740d..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:find', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate, {} ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 08cdcd5..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - tuple length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.find( predicate ); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof out !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':find:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 5de042e..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); - -bench( pkg+'::this_context:findIndex', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate, {} ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v > 0; - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index 8899fea..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Float32Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element passes a test -*/ -function predicate( value ) { - return value > 0.0; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Float32Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.findIndex( predicate ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':findIndex:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 096d0a8..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,88 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); - -bench( pkg+'::this_context:forEach', function benchmark( b ) { - var count; - var arr; - var N; - var i; - - arr = new Int8Array( 2 ); - N = arr.length; - - count = 0; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn, {} ); - if ( count !== N*(i+1) ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( count !== N*i ) { - b.fail( 'unexpected result' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn() { - count += 1; - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 578b8ad..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var count; - var arr; - - arr = new Int8Array( len ); - count = 0; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( fcn ); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - } - b.toc(); - if ( count !== count ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - /** - * Callback invoked for each tuple element. - * - * @private - */ - function fcn() { - count += 1; - } -} - - -// 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+':forEach:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index a2a4634..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( pkg+'::typed_array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Int8Array( [ 1, 2 ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::array:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::array,clbk:from', function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ 1, 2 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( buf, clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return v + 1; - } -}); - -bench( pkg+'::iterable:from', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable() ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 0, - 'done': false - }; - } - return { - 'done': true - }; - } - } -}); - -bench( pkg+'::iterable,clbk:from:', opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.from( createIterable(), clbk ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out; - var i; - - out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - - i = 0; - - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - i += 1; - if ( i <= 2 ) { - return { - 'value': 1, - 'done': false - }; - } - return { - 'done': true - }; - } - } - - function clbk( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index 551bc95..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':includes', function benchmark( b ) { - var bool; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index f3f7ea2..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - bool = arr.includes( v ); - 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+':includes:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index 0d348fe..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':indexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 026e1a0..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.indexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':indexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index db9b9e3..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':join', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 5e8bed6..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i % 127; - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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+':join:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 3ac8b4a..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index 3d9a5a0..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':keys', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 59e3934..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':lastIndexOf', function benchmark( b ) { - var out; - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - // Benchmark worst case scenario... - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index 91b994d..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = (i%127) + 1; - out = arr.lastIndexOf( v ); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - } - b.toc(); - if ( out !== -1 ) { - b.fail( 'should return -1' ); - } - 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+':lastIndexOf:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 409a708..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var ctor = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new ctor( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1951a99..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); - -bench( pkg+'::this_context:map', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn, {} ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 37dbcef..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Maps an array element to a new value. -* -* @private -* @param {*} value - array element -* @returns {*} new value -*/ -function fcn( value ) { - return value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( fcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':map:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index b3974e9..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':of', function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = Int8Array.of( i, 2 ); - if ( arr.length !== 2 ) { - b.fail( 'should have length 2' ); - } - } - b.toc(); - if ( !isInt8Array( arr ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.properties.js b/benchmark/benchmark.properties.js deleted file mode 100644 index 793fa84..0000000 --- a/benchmark/benchmark.properties.js +++ /dev/null @@ -1,145 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::get:buffer', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteLength', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:byteOffset', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:BYTES_PER_ELEMENT', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.BYTES_PER_ELEMENT; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::get:length', function benchmark( b ) { - var arr; - var v; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index ae13f81..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduce', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index 0be4eb7..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduce:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 9fe6c63..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( acc, v ) { - return acc + v + 1; - } -}); - -bench( pkg+'::initial_value:reduceRight', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn, 3 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function fcn( v ) { - return v + 1; - } -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index 4fcc4c2..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Updates an accumulated value. -* -* @private -* @param {*} acc - accumulated value -* @param {*} value - array element -* @returns {*} accumulated value -*/ -function fcn( acc, value ) { - return acc + value + 1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( fcn ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - 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+':reduceRight:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index ab74dfd..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':reverse', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 6232208..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':reverse:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index b70b686..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i ); - } - N = values.length; - - arr = new Int8Array( 2 ); - buf = [ 0 ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::typed_array:set', function benchmark( b ) { - var values; - var buf; - var arr; - var N; - var v; - var i; - - values = new Int8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i; - } - - arr = new Int8Array( 2 ); - buf = new Int8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 9f86e1d..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr; - var N; - var i; - - arr1 = []; - arr2 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( randi() ); - arr2.push( randi() ); - } - arr = new Int8Array( len ); - - values = [ - arr1, - arr2 - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - 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+':set:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index 6d2a93b..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':slice', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index 49062f5..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':slice:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a4d4844..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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; - } -}); - -bench( pkg+'::this_context:some', function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( 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.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 0103913..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether an array element passes a test. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating whether an array element 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 Int8Array( 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.some( 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+':some:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index fb72e06..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':sort', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( [ randi(), randi() ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 5a8e542..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 randi = require( '@stdlib/random-base-randi' ); -var isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var data; - var arr; - var i; - - data = []; - for ( i = 0; i < len; i++ ) { - data.push( randi() ); - } - arr = new Int8Array( data ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ i%len ] = randi(); - out = arr.sort(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':sort:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index b8e6845..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':subarray', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 352f724..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' ); -var pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isInt8Array( out ) ) { - b.fail( 'should return an Int8Array' ); - } - 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+':subarray:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index d4d119c..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toLocaleString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index 42436f5..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toLocaleString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 72873c1..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':toString', function benchmark( b ) { - var out; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2dd1b73..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new Int8Array( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr[ 0 ] = i; - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':toString:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index cb8bad5..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 pkg = require( './../package.json' ).name; -var Int8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg+':values', function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new Int8Array( 2 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4841ff2..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8" -%% click B href "https://github.com/stdlib-js/array-int8/tree/main" -%% click C href "https://github.com/stdlib-js/array-int8/tree/production" -%% click D href "https://github.com/stdlib-js/array-int8/tree/esm" -%% click E href "https://github.com/stdlib-js/array-int8/tree/deno" -%% click F href "https://github.com/stdlib-js/array-int8/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/int8 -[production-url]: https://github.com/stdlib-js/array-int8/tree/production -[deno-url]: https://github.com/stdlib-js/array-int8/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-int8/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-int8/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-int8/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-int8/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-int8/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..fee7627 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 572e3fb..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import Int8Array from '../docs/types/index'; -export = Int8Array; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ab4a2d1..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var e=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var o=e(function(y,i){"use strict";var a=typeof Int8Array=="function"?Int8Array:void 0;i.exports=a});var s=e(function(q,n){"use strict";function l(){throw new Error("not implemented")}n.exports=l});var p=require("@stdlib/assert-has-int8array-support"),c=o(),f=s(),t;p()?t=c:t=f;module.exports=t; -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 60db179..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,WAAc,WAAe,UAAY,OAK7DD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6BA,SAASC,GAAW,CACnB,MAAM,IAAI,MAAO,iBAAkB,CACpC,CAKAD,EAAO,QAAUC,ICFjB,IAAIC,EAAsB,QAAS,sCAAuC,EACtEC,EAAU,IACVC,EAAW,IAKXC,EACCH,EAAoB,EACxBG,EAAOF,EAEPE,EAAOD,EAMR,OAAO,QAAUC", - "names": ["require_main", "__commonJSMin", "exports", "module", "ctor", "require_polyfill", "__commonJSMin", "exports", "module", "polyfill", "hasInt8ArraySupport", "builtin", "polyfill", "ctor"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 34aaafe..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,953 +0,0 @@ - -{{alias}}() - A typed array constructor which returns a typed array representing an array - of twos-complement 8-bit signed integers in the platform byte order. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Returns a typed array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ) - [ 0, 0, 0, 0, 0 ] - - -{{alias}}( typedarray ) - Creates a typed array from another typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate another typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] ); - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( obj ) - Creates a typed array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a typed array. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = [ 5.0, 5.0, 5.0 ]; - > var arr2 = new {{alias}}( arr1 ) - [ 5, 5, 5 ] - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 4 ); - > var arr = new {{alias}}( buf, 0, 4 ) - [ 0, 0, 0, 0 ] - - -{{alias}}.from( src[, map[, thisArg]] ) - Creates a new typed array from an array-like object or an iterable. - - A callback is provided the following arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - map: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > function mapFcn( v ) { return v * 2; }; - > var arr = {{alias}}.from( [ 1, 2 ], mapFcn ) - [ 2, 4 ] - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new typed array from a variable number of arguments. - - Parameters - ---------- - element0: number - Array element. - - element1: number (optional) - Array element. - - elementN: ...number (optional) - Array elements. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( 1, 2 ) - [ 1, 2 ] - - -{{alias}}.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > {{alias}}.name - 'Int8Array' - - -{{alias}}.prototype.buffer - Read-only property which returns the ArrayBuffer referenced by the typed - array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.buffer - - - -{{alias}}.prototype.byteLength - Read-only property which returns the length (in bytes) of the typed array. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteLength - 5 - - -{{alias}}.prototype.byteOffset - Read-only property which returns the offset (in bytes) of the typed array - from the start of its ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.byteOffset - 0 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Number of bytes per view element. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - Read-only property which returns the number of view elements. - - Examples - -------- - > var arr = new {{alias}}( 5 ); - > arr.length - 5 - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > arr.copyWithin( 3, 0, 2 ); - > arr[ 3 ] - 1 - > arr[ 4 ] - 2 - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iter: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.entries(); - > it.next().value - [ 0, 1 ] - > it.next().value - [ 1, 2 ] - > it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Tests whether all array elements pass a test implemented by a predicate - function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all array elements pass. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v <= 1 ); }; - > arr.every( predicate ) - false - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Fills an array from a start index to an end index (non-inclusive) with a - provided value. - - Parameters - ---------- - value: number - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > arr.fill( 3 ); - > arr[ 0 ] - 3 - > arr[ 1 ] - 3 - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Creates a new array which includes those elements for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - If a predicate function does not return a truthy value for any array - element, the method returns `null`. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > var arr2 = arr1.filter( predicate ); - > arr2.length - 2 - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first array element for which a provided predicate function - returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - value: number|undefined - Array element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var v = arr.find( predicate ) - 3 - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first array element for which a provided predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function predicate( v ) { return ( v > 2 ); }; - > var idx = arr.findIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( fcn[, thisArg] ) - Invokes a callback for each array element. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - fcn: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Callback execution context. - - Examples - -------- - > var arr = new {{alias}}( [ 3, 2, 1 ] ); - > var str = ' '; - > function fcn( v, i ) { str += i + ':' + v + ' '; }; - > arr.forEach( fcn ); - > str - ' 0:3 1:2 2:1 ' - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a search element. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var bool = arr.includes( 4 ) - false - > bool = arr.includes( 3 ) - true - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the index of the first array element strictly equal to a search - element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > var idx = arr.indexOf( 4 ) - -1 - > idx = arr.indexOf( 3 ) - 2 - - -{{alias}}.prototype.join( [separator] ) - Serializes an array by joining all array elements as a string. - - Parameters - ---------- - separator: string (optional) - String delineating array elements. Default: ','. - - Returns - ------- - str: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.join( '|' ) - '1|2|3' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over array keys. - - Returns - ------- - iter: Iterator - Iterator for iterating over array keys. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.keys(); - > it.next().value - 0 - > it.next().value - 1 - > it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the index of the last array element strictly equal to a search - element. - - The method iterates from the last array element to the first array element. - - If unable to locate a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: number - Search element. - - fromIndex: integer (optional) - Array index from which to begin searching. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: -1. - - Returns - ------- - idx: integer - Array index. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] ); - > var idx = arr.lastIndexOf( 3 ) - -1 - > idx = arr.lastIndexOf( 0 ) - 3 - - -{{alias}}.prototype.map( fcn[, thisArg] ) - Maps each array element to an element in a new typed array. - - A provided function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - The returned array has the same data type as the host array. - - Parameters - ---------- - fcn: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( v ) { return v * 2; }; - > var arr2 = arr1.map( fcn ) - [ 2, 4, 6 ] - - -{{alias}}.prototype.reduce( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduce( fcn, 0 ) - 14 - - -{{alias}}.prototype.reduceRight( fcn[, initialValue] ) - Applies a function against an accumulator and each element in an array and - returns the accumulated result, iterating from right to left. - - The provided function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: index of the current array element. - - arr: array on which the method is invoked. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - fcn: Function - Function to apply. - - initialValue: Any (optional) - Initial accumulation value. - - Returns - ------- - out: Any - Accumulated result. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > function fcn( acc, v ) { return acc + (v*v); }; - > var v = arr.reduceRight( fcn, 0 ) - 14 - - -{{alias}}.prototype.reverse() - Reverses an array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ) - - > arr.reverse() - [ 3, 2, 1 ] - - -{{alias}}.prototype.set( arr[, offset] ) - Sets array elements. - - Parameters - ---------- - arr: ArrayLike - Source array containing array values to set. - - offset: integer (optional) - Array index at which to start writing values. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.set( [ 4, 4 ], 1 ); - > arr[ 1 ] - 4 - > arr[ 2 ] - 4 - - -{{alias}}.prototype.slice( [begin[, end]] ) - Copies array elements to a new array with the same underlying data type as - the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns `null`. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3 ] ); - > var arr2 = arr1.slice( 1 ); - > arr2.length - 2 - > arr2[ 0 ] - 2 - > arr2[ 1 ] - 3 - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Tests whether at least one array element passes a test implemented by a - predicate function. - - A predicate function is provided the following arguments: - - - value: array element. - - index: array index. - - arr: array on which the method is invoked. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, a array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one array element passes. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > function predicate( v ) { return ( v > 1 ); }; - > arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array *in-place*. - - The comparison function is provided two array elements per invocation: `a` - and `b`. - - The comparison function return value determines the sort order as follows: - - - If the comparison function returns a value less than zero, then the method - sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`). - - - If the comparison function returns a value greater than zero, then the - method sorts `a` to an index higher than `b` (i.e., `b` should come *before* - `a`). - - - If the comparison function returns zero, then the relative order of `a` - and `b` should remain unchanged. - - This method mutates the array on which the method is invoked. - - Parameters - ---------- - compareFunction: Function (optional) - Function which specifies the sort order. The default sort order is - ascending order. - - Returns - ------- - out: Int8Array - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] ); - > arr.sort() - [ 0, 1, 1, 2, 2 ] - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array over the same underlying ArrayBuffer and with the - same underlying data type as the host array. - - If the method is unable to resolve indices to a non-empty array subsequence, - the method returns an empty typed array. - - Parameters - ---------- - begin: integer (optional) - Start element index (inclusive). If less than zero, the start index is - resolved relative to the last array element. Default: 0. - - end: integer (optional) - End element index (exclusive). If less than zero, the end index is - resolved relative to the last array element. Default: arr.length. - - Returns - ------- - out: Int8Array - A new typed array view. - - Examples - -------- - > var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] ); - > var arr2 = arr1.subarray( 2 ) - [ 3, 4, 5 ] - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - A BCP 47 language tag, or an array of such tags. - - options: Object (optional) - Options. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toLocaleString() - '1,2,3' - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - str: string - A typed array string representation. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2, 3 ] ); - > arr.toString() - '1,2,3' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over array elements. - - Returns - ------- - iter: Iterator - Iterator for iterating over array elements. - - Examples - -------- - > var arr = new {{alias}}( [ 1, 2 ] ); - > it = arr.values(); - > it.next().value - 1 - > it.next().value - 2 - > it.next().done - true - - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2d20dc4..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -// TypeScript Version: 4.1 - -// EXPORTS // - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -*/ -export = Int8Array; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 35398aa..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import Int8Array = require( './index' ); - - -// TESTS // - -// The function returns a typed array instance... -{ - new Int8Array( 10 ); // $ExpectType Int8Array - new Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectType Int8Array -} - -// The constructor function has to be invoked with `new`... -{ - Int8Array( 10 ); // $ExpectError - Int8Array( [ 2, 5, 5, 7 ] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 3dfeb21..0000000 --- a/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var randu = require( '@stdlib/random-base-randu' ); -var round = require( '@stdlib/math-base-special-round' ); -var ctor = require( './../lib' ); - -var arr; -var i; - -arr = new ctor( 10 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = round( randu()*100.0 ); -} -console.log( arr ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9a40bbf --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var t,n;t=this,n=function(){"use strict";var t,n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol?Symbol:void 0,f="function"==typeof r?r.toStringTag:"",i=n&&"symbol"==typeof Symbol.toStringTag?function(t){var n,r,i,l,y;if(null==t)return o.call(t);r=t[f],y=f,n=null!=(l=t)&&e.call(l,y);try{t[f]=void 0}catch(n){return o.call(t)}return i=o.call(t),n?t[f]=r:delete t[f],i}:function(t){return o.call(t)},l="function"==typeof Int8Array,y="function"==typeof Int8Array?Int8Array:null,c="function"==typeof Int8Array?Int8Array:void 0;return t=function(){var t,n,o;if("function"!=typeof y)return!1;try{n=new y([1,3.14,-3.14,128]),o=n,t=(l&&o instanceof Int8Array||"[object Int8Array]"===i(o))&&1===n[0]&&3===n[1]&&-3===n[2]&&-128===n[3]}catch(n){t=!1}return t}()?c:function(){throw new Error(function(){var t,n=arguments,o="https://stdlib.io/e/"+n[0]+"?";for(t=1;t\n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nimport isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( format('01100') );\n}\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n"],"names":["ctor","FLG","Symbol","toStr","Object","prototype","toString","has","hasOwnProperty","Sym","toStrTag","toStringTag","nativeClass","v","isOwn","tag","out","value","property","call","err","hasInt8Array","Int8Array","main","bool","arr","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","builtin","Error","i","a","arguments","u","length","encodeURIComponent","format"],"mappings":";yCA2BA,ICcIA,EDdAC,EEMgB,mBAAXC,QACoB,iBAApBA,OAAQ,OCZbC,EAAQC,OAAOC,UAAUC,SCAzBC,EAAMH,OAAOC,UAAUG,eCAvBC,EAA0B,mBAAXP,OAA0BA,YAAS,ECKlDQ,EAA+B,mBAAXR,EAA0BA,EAAOS,YAAc,GCiCvEC,EPlBUX,GAAqC,iBAAvBC,OAAOS,YQQ/B,SAAsBE,GACrB,IAAIC,EACAC,EACAC,EJHgBC,EAAOC,EIK3B,GAAKL,QACJ,OAAOV,EAAMgB,KAAMN,GAEpBE,EAAMF,EAAGF,GJRkBO,EISJP,EAAvBG,EJPCG,OAFmBA,EISAJ,IJFbN,EAAIY,KAAMF,EAAOC,GIKxB,IACCL,EAAGF,QAAgB,CACnB,CAAC,MAAQS,GACT,OAAOjB,EAAMgB,KAAMN,EACnB,CAQD,OAPAG,EAAMb,EAAMgB,KAAMN,GAEbC,EACJD,EAAGF,GAAgBI,SAEZF,EAAGF,GAEJK,CACR,EC3BA,SAAsBH,GACrB,OAAOV,EAAMgB,KAAMN,EACpB,ECvBIQ,EAAsC,mBAAdC,UCLxBC,EAA8B,mBAAdD,UAA6BA,UAAY,KCAzDtB,EAA8B,mBAAdsB,UAA6BA,eAAY,SXuB5DtB,EYND,WACC,IAAIwB,EACAC,EHKiBR,EGHrB,GAAgC,mBAApBS,EACX,OAAO,EAGR,IACCD,EAAM,IAAIC,EAAiB,CAAE,EAAG,MAAO,KAAMC,MHFzBV,EGINQ,EADdD,GHDEH,GAAgBJ,aAAiBK,WACV,uBAAzBV,EAAaK,KGEC,IAAbQ,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,EAEN,CAAC,MAAQL,GACTI,GAAO,CACP,CACD,OAAOA,CACR,CZlBKI,GACGC,EcZR,WACC,MAAM,IAAIC,MCCX,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEG,OAAQJ,IAC1BG,GAAK,UAAYE,mBAAoBJ,EAAGD,IAEzC,OAAOG,CACR,CDVkBG,CAAO,SACzB,EdkBerC","x_google_ignoreList":[0,2,3,4,5,6,7,8,9,10,11,13,14,16]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b4b39f..0000000 --- a/lib/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @module @stdlib/array-int8 -* -* @example -* var ctor = require( '@stdlib/array-int8' ); -* -* var arr = new ctor( 10 ); -* // returns -*/ - -// MODULES // - -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var ctor; -if ( hasInt8ArraySupport() ) { - ctor = builtin; -} else { - ctor = polyfill; -} - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 667410e..0000000 --- a/lib/main.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -var ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals - - -// EXPORTS // - -module.exports = ctor; diff --git a/lib/polyfill.js b/lib/polyfill.js deleted file mode 100644 index d2cc855..0000000 --- a/lib/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var format = require('@stdlib/error-tools-fmtprodmsg'); - -// TODO: write polyfill - -// MAIN // - -/** -* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. -* -* @throws {Error} not implemented -*/ -function polyfill() { - throw new Error( format('01100') ); -} - -// EXPORTS // - -module.exports = polyfill; diff --git a/package.json b/package.json index 8a41d94..4ed4b50 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Int8Array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-int8array-support": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-is-arraybuffer": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-int8array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/random-base-randi": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/symbol-iterator": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -95,4 +34,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5a89df8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..84f7bb1 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 00f053e..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,320 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Int8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Int8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'a typed array instance has a `copyWithin` method for copying a sequence of elements within a typed array', function test( t ) { - var arr = new Int8Array( 2 ); - t.strictEqual( hasProp( arr, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( arr.copyWithin ), true, 'has method' ); - 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 arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new Int8Array( 2 ); - - values = [ - '5', - 5, - 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.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within a typed array', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative target)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( -p.length, 3 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, -2 ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (end=length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 0, 3, p.length ); - - // Overwritten: - t.strictEqual( p[ 0 ], 3, 'returns expected value' ); - t.strictEqual( p[ 1 ], 4, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (non-inclusive end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, 2 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (negative end)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0, -3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - - // Remain the same: - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target >= length)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( p.length, 3 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - t.strictEqual( p[ 2 ], 2, 'returns expected value' ); - t.strictEqual( p[ 3 ], 3, 'returns expected value' ); - t.strictEqual( p[ 4 ], 4, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within a typed array (target > start)', function test( t ) { - var arr; - var p; - - arr = [ - 0, - 1, - 2, - 3, - 4 - ]; - - p = new Int8Array( arr ); - p.copyWithin( 2, 0 ); - - // Remain the same: - t.strictEqual( p[ 0 ], 0, 'returns expected value' ); - t.strictEqual( p[ 1 ], 1, 'returns expected value' ); - - // Overwritten: - t.strictEqual( p[ 2 ], 0, 'returns expected value' ); - t.strictEqual( p[ 3 ], 1, 'returns expected value' ); - t.strictEqual( p[ 4 ], 2, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 73a4138..0000000 --- a/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 proxyquire = require( 'proxyquire' ); -var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' ); -var polyfill = require( './../lib/polyfill.js' ); -var ctor = require( './../lib' ); - - -// VARIABLES // - -var hasInt8Arrays = hasInt8ArraySupport(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if an environment supports `Int8Array`, the export is an alias for `Int8Array`', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isTrue, - './main.js': Mock - }); - t.strictEqual( Foo, Mock, 'returns builtin' ); - - if ( hasInt8Arrays ) { - t.strictEqual( ctor, Int8Array, 'is alias' ); // eslint-disable-line stdlib/require-globals - } - - t.end(); - - function Mock() { - return this; - } - - function isTrue() { - return true; - } -}); - -tape( 'if an environment does not support `Int8Array`, the export is a polyfill', function test( t ) { - var Foo; - - Foo = proxyquire( './../lib', { - '@stdlib/assert-has-int8array-support': isFalse - }); - - t.strictEqual( Foo, polyfill, 'returns polyfill' ); - t.end(); - - function isFalse() { - return false; - } -}); diff --git a/test/test.polyfill.js b/test/test.polyfill.js deleted file mode 100644 index 9d6fcb1..0000000 --- a/test/test.polyfill.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 ctor = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error when invoked', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - var f = new ctor(); // eslint-disable-line no-unused-vars - } -}); - -// TODO: tests